kaui 3.0.1 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/app/assets/config/kaui_manifest.js +2 -44
  4. data/app/assets/images/kaui/logo.svg +37 -0
  5. data/app/assets/javascripts/application.js +12 -0
  6. data/app/assets/javascripts/kaui/kaui.js +7 -452
  7. data/app/assets/javascripts/kaui/kaui_override.js +441 -0
  8. data/app/assets/stylesheets/application.css +23 -0
  9. data/app/assets/stylesheets/kaui/account.css +34 -0
  10. data/app/assets/stylesheets/kaui/audit.css +19 -0
  11. data/app/assets/stylesheets/kaui/common.css +550 -0
  12. data/app/assets/stylesheets/kaui/datatable.css +71 -0
  13. data/app/assets/stylesheets/kaui/header.css +129 -0
  14. data/app/assets/stylesheets/kaui/home.css +72 -0
  15. data/app/assets/stylesheets/kaui/invoice.css +37 -0
  16. data/app/assets/stylesheets/kaui/kaui.css +152 -0
  17. data/app/assets/stylesheets/kaui/overdue.css +7 -0
  18. data/app/assets/stylesheets/kaui/payment.css +28 -0
  19. data/app/assets/stylesheets/kaui/subscription.css +15 -0
  20. data/app/assets/stylesheets/kaui/tags.css +137 -0
  21. data/app/assets/stylesheets/kaui/timeline.css +5 -0
  22. data/app/assets/stylesheets/kaui/tooltip.css +16 -0
  23. data/app/controllers/kaui/account_tags_controller.rb +1 -1
  24. data/app/controllers/kaui/accounts_controller.rb +5 -6
  25. data/app/controllers/kaui/admin_allowed_users_controller.rb +1 -1
  26. data/app/controllers/kaui/admin_tenants_controller.rb +22 -9
  27. data/app/controllers/kaui/audit_logs_controller.rb +3 -3
  28. data/app/controllers/kaui/bundle_tags_controller.rb +1 -1
  29. data/app/controllers/kaui/charges_controller.rb +1 -1
  30. data/app/controllers/kaui/credits_controller.rb +1 -1
  31. data/app/controllers/kaui/custom_fields_controller.rb +3 -3
  32. data/app/controllers/kaui/engine_controller_util.rb +1 -1
  33. data/app/controllers/kaui/home_controller.rb +25 -16
  34. data/app/controllers/kaui/invoice_items_controller.rb +1 -1
  35. data/app/controllers/kaui/invoice_tags_controller.rb +1 -1
  36. data/app/controllers/kaui/invoices_controller.rb +10 -5
  37. data/app/controllers/kaui/payment_methods_controller.rb +4 -4
  38. data/app/controllers/kaui/payments_controller.rb +1 -1
  39. data/app/controllers/kaui/refunds_controller.rb +3 -2
  40. data/app/controllers/kaui/subscriptions_controller.rb +17 -16
  41. data/app/controllers/kaui/transactions_controller.rb +3 -3
  42. data/app/helpers/kaui/object_helper.rb +16 -1
  43. data/app/models/kaui/admin_tenant.rb +1 -1
  44. data/app/models/kaui/catalog.rb +2 -2
  45. data/app/models/kaui/custom_field.rb +1 -1
  46. data/app/models/kaui/invoice_payment.rb +1 -1
  47. data/app/models/kaui/overdue.rb +2 -2
  48. data/app/models/kaui/payment_method.rb +4 -4
  49. data/app/models/kaui/tag.rb +2 -2
  50. data/app/models/kaui/tag_definition.rb +1 -1
  51. data/app/views/kaui/accounts/_billing_info.html.erb +2 -4
  52. data/app/views/kaui/accounts/_form.html.erb +3 -3
  53. data/app/views/kaui/accounts/index.html.erb +0 -1
  54. data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +5 -5
  55. data/app/views/kaui/home/_advanced_search_modal.html.erb +22 -1
  56. data/app/views/kaui/invoices/show.html.erb +2 -1
  57. data/app/views/kaui/layouts/kaui_header.html.erb +2 -18
  58. data/app/views/kaui/layouts/kaui_navbar.html.erb +1 -1
  59. data/app/views/kaui/refunds/_form.html.erb +50 -2
  60. data/app/views/kaui/subscriptions/_cancel_by_date_modal.html.erb +1 -1
  61. data/app/views/kaui/subscriptions/_edit_form.html.erb +1 -1
  62. data/app/views/kaui/subscriptions/_form.html.erb +1 -1
  63. data/app/views/kaui/subscriptions/edit_bcd.erb +1 -1
  64. data/app/views/kaui/tag_definitions/_form.html.erb +1 -2
  65. data/config/routes.rb +1 -0
  66. data/lib/kaui/engine.rb +1 -4
  67. data/lib/kaui/version.rb +1 -1
  68. data/lib/kaui.rb +10 -10
  69. data/lib/tasks/kaui_tasks.rake +1 -0
  70. metadata +30 -131
  71. data/app/assets/images/kaui/logo.png +0 -0
  72. data/app/assets/javascripts/jquery.spin.js +0 -76
  73. data/app/assets/javascripts/kaui_application.js +0 -25
  74. data/app/assets/javascripts/spin.js +0 -76
  75. data/app/assets/stylesheets/bootstrap_and_overrides.scss +0 -240
  76. data/app/assets/stylesheets/kaui/account.scss +0 -52
  77. data/app/assets/stylesheets/kaui/audit.scss +0 -42
  78. data/app/assets/stylesheets/kaui/common.scss +0 -765
  79. data/app/assets/stylesheets/kaui/datatable.scss +0 -115
  80. data/app/assets/stylesheets/kaui/header.scss +0 -197
  81. data/app/assets/stylesheets/kaui/home.scss +0 -89
  82. data/app/assets/stylesheets/kaui/invoice.scss +0 -58
  83. data/app/assets/stylesheets/kaui/kaui.scss +0 -265
  84. data/app/assets/stylesheets/kaui/kaui_bootstrap.scss +0 -3
  85. data/app/assets/stylesheets/kaui/overdue.scss +0 -11
  86. data/app/assets/stylesheets/kaui/payment.scss +0 -43
  87. data/app/assets/stylesheets/kaui/subscription.scss +0 -27
  88. data/app/assets/stylesheets/kaui/tags.scss +0 -208
  89. data/app/assets/stylesheets/kaui/timeline.scss +0 -7
  90. data/app/assets/stylesheets/kaui/tooltip.scss +0 -15
  91. data/app/assets/stylesheets/kaui_application.css +0 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c270a67aa73b6b9195aae2e4578519dde9bdefab0bdb4fdd1f7a59a8137fb7a
4
- data.tar.gz: 48791ecdfe32bbb730a447e8e994ab127acabd36fc356bedb023f8e67dc174ef
3
+ metadata.gz: fdb45a75d2f3a57307ffe426a864911262563d623f25cccefd3941de52655e36
4
+ data.tar.gz: f45cbd12e90f63dfb544743381af6c4a2dbeab58fe0671334f02198bdeb97323
5
5
  SHA512:
6
- metadata.gz: 13e7dc0a95b7a6bd39f3996a50fd32c7216b4eb7e2507b386a5bbe6cd959358e631a6520bafb6bf83f4573b730904bb9058a3475c851c7e3540ecd31e0280987
7
- data.tar.gz: 402e25c2418833089ab69307de78deaa64597d76e0d40c07daa37dd15d050ba9b3b35e6e9a1485447faf07ee458e364de0d2c7dac02172bbb3c7bdf853e584b4
6
+ metadata.gz: 065274ae77055af9c3a54b7938f8c8f0d09775b5d7a7b4e953c990790ad7e4af247096b287f308062e53f09b13d16eda146ccd893c762baa3dc7ab644f8a3c01
7
+ data.tar.gz: 15cd32d52a680d624be8bf85f3db439f1afc78ad5d7308054fecf7aad66d130f8a5bd324ec93ba7fd140399be84f4eec6015e1c9a054f55f368f8c4202ecebfb
data/README.md CHANGED
@@ -12,7 +12,8 @@ Kill Bill compatibility
12
12
  | 0.15.y | 0.18.z (Rails 4) |
13
13
  | 0.16.y | 0.18.z (Rails 5) |
14
14
  | 1.x.y | 0.20.z (Rails 5) |
15
- | 2.x.y | 0.22.z (Rails 5) |
15
+ | 2.1.y | 0.22.z (Rails 5) |
16
+ | 2.2.y | 0.24.z (Rails 6) |
16
17
  | 3.x.y | 0.24.z (Rails 7) |
17
18
 
18
19
  Dependencies
@@ -1,45 +1,3 @@
1
-
2
- //= link jquery.js
3
- //= link jquery-ui.js
4
- //= link popper.js
5
- //= require spin
6
- //= require jquery.spin
7
- //= link spin.js
8
- //= link jquery.spin.js
9
- //= link bootstrap-sprockets.js
10
- //= link bootstrap-datepicker.js
11
- //= link_tree ../images/kaui
1
+ //= link_tree ../images
12
2
  //= link_directory ../javascripts .js
13
- //= link mustache.js
14
- //= link bootstrap-datepicker3.css
15
- //= link jquery-ui/widgets/autocomplete.js
16
- //= link dataTables/jquery.dataTables.js
17
- //= link dataTables/bootstrap/3/jquery.dataTables.bootstrap.js
18
- //= link dataTables/extras/dataTables.colVis.js
19
- //= link d3.js
20
- //= link dataTables/jquery.dataTables.css
21
- //= link jquery-ui/autocomplete.css
22
- //= link dataTables/bootstrap/3/jquery.dataTables.bootstrap.css
23
- //= link bootstrap_and_overrides.scss
24
- //= link kaui/kaui.scss
25
- //= link kaui_application.css
26
-
27
- // Kanaui
28
- //= require js-routes
29
- //= require spin
30
- //= require jquery.spin
31
- //= link spin.js
32
- //= link jquery.spin.js
33
- // KPM
34
- // kpm/kpm.js
35
-
36
- // payment_test
37
- // payment_test/payment_test.js
38
-
39
- // Deposit
40
- // deposit/deposit.js
41
- //
42
- // Kaui (needs to be loaded last for overrides)
43
- //= link kaui/kaui.js
44
- //
45
-
3
+ //= link_directory ../stylesheets .css
@@ -0,0 +1,37 @@
1
+ <svg width="138" height="36" viewBox="0 0 138 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8.96891 13.6363L17.1663 16.2316L19.867 20.7179L7.22926 20.294L5.87472 17.7276C4.70442 15.5102 6.6717 12.9089 8.96891 13.6363Z" fill="url(#paint0_linear_5656_117635)"/>
3
+ <path d="M2.73109 18.8862L23.0656 19.4261L31.0472 32.6526C31.9039 34.0722 30.9562 35.9453 29.3786 35.9506L14.6421 36C12.8282 36.0061 11.0908 35.2177 9.83259 33.8178L0.749744 23.712C-0.899153 21.8774 0.354861 18.8231 2.73109 18.8862Z" fill="url(#paint1_linear_5656_117635)"/>
4
+ <path d="M20.5179 0.919922L15.7246 7.75567L23.189 11.3725L24.8913 4.89582L20.5179 0.919922Z" fill="url(#paint2_linear_5656_117635)"/>
5
+ <path d="M27.5141 34.8764L15.4574 13.4093C14.4372 11.5929 14.565 9.35199 15.785 7.66255C16.4888 6.68792 17.8875 6.54241 18.778 7.35118L34.1718 21.3321C36.1567 23.1348 36.5779 26.0884 35.1757 28.371L31.1361 34.9469C30.2983 36.3107 28.2978 36.2717 27.5141 34.8764Z" fill="url(#paint3_linear_5656_117635)"/>
6
+ <path d="M32.0753 11.0799L21.0977 3.84213C19.1972 2.5891 20.3796 -0.360792 22.623 0.0364992L27.8828 0.967948C29.1553 1.19329 30.1995 2.09954 30.5986 3.32489L32.9165 10.4422C33.0801 10.9445 32.5171 11.3713 32.0753 11.0799Z" fill="url(#paint4_linear_5656_117635)"/>
7
+ <path d="M69.3857 29.5787C68.2643 29.5787 67.3552 28.684 67.3552 27.5803V14.5758C67.3552 13.4721 68.2643 12.5774 69.3857 12.5774C70.5072 12.5774 71.4163 13.4721 71.4163 14.5758V27.5803C71.4163 28.684 70.5072 29.5787 69.3857 29.5787ZM69.402 9.77566C68.6439 9.77566 68.0158 9.54218 67.5176 9.07523C67.0411 8.60827 66.8028 8.04581 66.8028 7.38783C66.8028 6.70862 67.0411 6.14616 67.5176 5.70043C68.0158 5.23348 68.6439 5 69.402 5C70.1601 5 70.7773 5.22286 71.2539 5.66859C71.752 6.0931 72.0011 6.63434 72.0011 7.29231C72.0011 7.99274 71.7629 8.58705 71.2863 9.07523C70.8098 9.54218 70.1817 9.77566 69.402 9.77566Z" fill="#293056"/>
8
+ <path d="M77.4776 29.5787C76.3561 29.5787 75.447 28.684 75.447 27.5803V7.9536C75.447 6.84988 76.3561 5.95513 77.4776 5.95513C78.599 5.95513 79.5081 6.84988 79.5081 7.9536V27.5803C79.5081 28.684 78.599 29.5787 77.4776 29.5787Z" fill="#293056"/>
9
+ <path d="M85.5694 29.5787C84.4479 29.5787 83.5388 28.684 83.5388 27.5803V7.9536C83.5388 6.84987 84.4479 5.95513 85.5694 5.95513C86.6908 5.95513 87.6 6.84988 87.6 7.9536V27.5803C87.6 28.684 86.6908 29.5787 85.5694 29.5787Z" fill="#293056"/>
10
+ <path d="M119.786 29.5787C118.664 29.5787 117.755 28.684 117.755 27.5803V14.5758C117.755 13.4721 118.664 12.5774 119.786 12.5774C120.907 12.5774 121.816 13.4721 121.816 14.5758V27.5803C121.816 28.684 120.907 29.5787 119.786 29.5787ZM119.802 9.77566C119.044 9.77566 118.416 9.54218 117.918 9.07523C117.441 8.60827 117.203 8.04581 117.203 7.38783C117.203 6.70862 117.441 6.14616 117.918 5.70043C118.416 5.23348 119.044 5 119.802 5C120.56 5 121.177 5.22286 121.654 5.66859C122.152 6.0931 122.401 6.63434 122.401 7.29231C122.401 7.99274 122.163 8.58705 121.686 9.07523C121.21 9.54218 120.582 9.77566 119.802 9.77566Z" fill="#293056"/>
11
+ <path d="M127.878 29.5787C126.756 29.5787 125.847 28.684 125.847 27.5803V7.9536C125.847 6.84987 126.756 5.95513 127.878 5.95513C128.999 5.95513 129.908 6.84988 129.908 7.9536V27.5803C129.908 28.684 128.999 29.5787 127.878 29.5787Z" fill="#293056"/>
12
+ <path d="M135.969 29.5787C134.848 29.5787 133.939 28.684 133.939 27.5803V7.9536C133.939 6.84987 134.848 5.95513 135.969 5.95513C137.091 5.95513 138 6.84988 138 7.9536V27.5803C138 28.684 137.091 29.5787 135.969 29.5787Z" fill="#293056"/>
13
+ <path d="M59.977 13.0294C60.2978 12.7387 60.7179 12.5774 61.1539 12.5774C62.702 12.5774 63.4773 14.4195 62.3826 15.4968L58.1099 19.7015L63.5453 26.4787C64.552 27.734 63.6435 29.5787 62.0187 29.5787C61.4331 29.5787 60.8787 29.319 60.5094 28.8718L55.0817 22.2982L52.0611 25.0975V27.5803C52.0611 28.684 51.152 29.5787 50.0306 29.5787C48.9091 29.5787 48 28.684 48 27.5803V7.9536C48 6.84987 48.9091 5.95513 50.0306 5.95513C51.152 5.95513 52.0611 6.84988 52.0611 7.9536V20.2027L59.977 13.0294Z" fill="#293056"/>
14
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M106.399 29.8016C104.926 29.8016 103.615 29.4832 102.468 28.8465C101.774 28.4618 101.168 27.9611 100.648 27.3441V27.6762C100.648 28.7269 99.7826 29.5787 98.715 29.5787C97.6474 29.5787 96.7819 28.7269 96.7819 27.6762V7.9536C96.7819 6.84987 97.691 5.95513 98.8125 5.95513C99.9339 5.95513 100.843 6.84988 100.843 7.9536V14.6575C101.337 14.1191 101.9 13.6804 102.532 13.3415C103.702 12.7047 104.991 12.3864 106.399 12.3864C108.11 12.3864 109.615 12.7472 110.915 13.4688C112.236 14.1905 113.276 15.1987 114.034 16.4934C114.813 17.7882 115.203 19.3164 115.203 21.0781C115.203 22.8397 114.813 24.3679 114.034 25.6627C113.276 26.9574 112.236 27.9762 110.915 28.7191C109.615 29.4408 108.11 29.8016 106.399 29.8016ZM108.543 25.7582C107.785 26.1827 106.919 26.395 105.944 26.395C104.969 26.395 104.092 26.1827 103.312 25.7582C102.532 25.3337 101.915 24.7182 101.46 23.9116C101.006 23.1051 100.778 22.1605 100.778 21.0781C100.778 19.9743 101.006 19.0298 101.46 18.2445C101.915 17.4379 102.532 16.8224 103.312 16.3979C104.092 15.9734 104.969 15.7612 105.944 15.7612C106.919 15.7612 107.785 15.9734 108.543 16.3979C109.323 16.8224 109.94 17.4379 110.395 18.2445C110.85 19.0298 111.077 19.9743 111.077 21.0781C111.077 22.1605 110.85 23.1051 110.395 23.9116C109.94 24.7182 109.323 25.3337 108.543 25.7582Z" fill="#293056"/>
15
+ <defs>
16
+ <linearGradient id="paint0_linear_5656_117635" x1="6.3713" y1="14.584" x2="17.3232" y2="20.2038" gradientUnits="userSpaceOnUse">
17
+ <stop stop-color="#004EEB"/>
18
+ <stop offset="1" stop-color="#2970FF"/>
19
+ </linearGradient>
20
+ <linearGradient id="paint1_linear_5656_117635" x1="1.04487" y1="21.155" x2="29.4032" y2="32.4876" gradientUnits="userSpaceOnUse">
21
+ <stop stop-color="#2970FF"/>
22
+ <stop offset="1" stop-color="#7CD4FD"/>
23
+ </linearGradient>
24
+ <linearGradient id="paint2_linear_5656_117635" x1="19.8881" y1="9.67384" x2="23.8884" y2="4.93559" gradientUnits="userSpaceOnUse">
25
+ <stop stop-color="#A6EF67"/>
26
+ <stop offset="1" stop-color="#FDE172"/>
27
+ </linearGradient>
28
+ <linearGradient id="paint3_linear_5656_117635" x1="15.1997" y1="8.83686" x2="29.3077" y2="34.3257" gradientUnits="userSpaceOnUse">
29
+ <stop stop-color="#A6EF67"/>
30
+ <stop offset="1" stop-color="#15B79E"/>
31
+ </linearGradient>
32
+ <linearGradient id="paint4_linear_5656_117635" x1="20.833" y1="1.40851" x2="32.7401" y2="9.43028" gradientUnits="userSpaceOnUse">
33
+ <stop stop-color="#FDE172"/>
34
+ <stop offset="1" stop-color="#EAAA08"/>
35
+ </linearGradient>
36
+ </defs>
37
+ </svg>
@@ -0,0 +1,12 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require assets/common
8
+ //= require js-routes
9
+ //= require jquery-ui/widgets/autocomplete
10
+ //= require mustache
11
+ //= require popper
12
+ //= require kaui/kaui
@@ -1,452 +1,7 @@
1
- jQuery(document).ready(function ($) {
2
-
3
- /*
4
- * Mobile Data Adjustment
5
- */
6
-
7
- var running = false;
8
- $('table.mobile-data').each(function () {
9
- var count = $(this).find($('table.mobile-data tr')).length - 1;
10
- $(this).append('<span class="left"><i class="fa fa-arrow-circle-left"></i></span>');
11
- $(this).append('<span class="right"><i class="fa fa-arrow-circle-right"></i></span>');
12
- $(this).append('<span class="center"><span class="current">1</span>/' + count + '</span>');
13
- });
14
- $('table.mobile-data > span.left').click(function () {
15
-
16
- if (running === true)
17
- return;
18
-
19
- running = true;
20
-
21
- var table = $(this).parent('table').children('tbody'),
22
- current = table.find('tr:first-of-type'),
23
- next = table.find('tr:last-of-type'),
24
- page = table.children('span.center').children('span.current'),
25
- number = parseInt(page.html()),
26
- count = table.find($('table.mobile-data tr')).length - 1;
27
-
28
- next.insertBefore(current);
29
- number--;
30
- if (number <= 0) {
31
- number = count;
32
- }
33
- page.html(number);
34
-
35
- fixCellHeight(table);
36
-
37
- running = false;
38
-
39
- });
40
- $('table.mobile-data > span.right').click(function () {
41
-
42
- if (running === true)
43
- return;
44
-
45
- running = true;
46
-
47
- var table = $(this).parent('table').children('tbody'),
48
- current = table.find('tr:first-of-type'),
49
- last = table.find('tr:last-of-type'),
50
- page = table.children('span.center').children('span.current'),
51
- number = parseInt(page.html()),
52
- count = table.find($('table.mobile-data tr')).length - 1;
53
-
54
- current.insertAfter(last);
55
- number++;
56
- if (number > count) {
57
- number = 1;
58
- }
59
- page.html(number);
60
-
61
- fixCellHeight(table);
62
-
63
- running = false;
64
-
65
- });
66
-
67
- function fixCellHeight(table) {
68
-
69
- table.find('tr:first-of-type').children('th').each(function (i) {
70
- i++;
71
- var brother = table.find('tr:nth-of-type(2)').children('td:nth-of-type(' + i + ')');
72
-
73
- if ($(this).height() > brother.height()) {
74
- brother.css('height', $(this).outerHeight() + 'px');
75
- } else {
76
- $(this).css('height', brother.outerHeight() + 'px');
77
- }
78
-
79
- });
80
-
81
- }
82
-
83
- if ($(window).width() <= 768) {
84
- $('table.mobile-data').each(function () {
85
- fixCellHeight($(this));
86
- });
87
- }
88
-
89
-
90
- /*
91
- * Toggler activation
92
- */
93
- $('.toggler .first-line').click( function(e){
94
- if (! ($(e.target).is('a') || $(e.target).parent().is('a'))) {
95
- e.preventDefault();
96
- $(this).parent('.toggler').toggleClass('toggled');
97
- }
98
- });
99
-
100
- /*
101
- * Toggle between combobox (US only) and text when entering the state.
102
- */
103
- $('#account_country').on('change', function(e){
104
- toggle_state_input_type($('#account_country').val());
105
- });
106
-
107
- function toggle_state_input_type(state){
108
- if (state == 'US'){
109
- $('.text-state').hide().attr('name','hide');
110
- $('.select-state').show().attr('name','account[state]');
111
- }else{
112
- $('.select-state').hide().attr('name','hide');
113
- $('.text-state').show().attr('name','account[state]');
114
- }
115
- }
116
-
117
- toggle_state_input_type($('#account_country').val());
118
-
119
- /*
120
- * Calculate first name length
121
- */
122
-
123
- $('#account_name').on('keyup', function(e){
124
- set_first_name_length($(this).val());
125
- });
126
-
127
- $('#account_name').on('change', function(e){
128
- if ($('#account_first_name_length').empty() ){
129
- set_first_name_length($(this).val());
130
- }
131
- });
132
-
133
- function set_first_name_length(name){
134
- var name_in_parts = name.trim().split(' ');
135
-
136
- if (name_in_parts.length > 1){
137
- $('#account_first_name_length').val(name_in_parts[0].length);
138
- }else{
139
- $('#account_first_name_length').val('');
140
- }
141
- }
142
-
143
-
144
- /*
145
- * Custom Fields Errors
146
- */
147
-
148
-
149
- $('#custom_field_object_type').change(function(){
150
-
151
- ajaxCloseAlert();
152
-
153
- var uuid = document.getElementById("custom_field_object_id").value;
154
- var my_url = '/custom_fields/check_object_exist';
155
- obj_type = document.getElementById("custom_field_object_type").value;
156
-
157
- if (uuid){
158
- $.ajax({
159
- url: my_url,
160
- type: "GET",
161
- dataType: "json",
162
- data: {
163
- uuid: uuid,
164
- object_type: obj_type
165
- },
166
- success: function(data) {
167
- if (data.status == 431) {
168
- var msg = data["message"];
169
- ajaxErrorAlert(msg);
170
-
171
- }
172
- }
173
- });
174
- }else{
175
- var msg = 'Object ID cannot be empty';
176
- ajaxErrorAlert(msg);
177
- }
178
-
179
-
180
-
181
-
182
-
183
-
184
- });
185
-
186
- $('#custom_field_object_id').on('keyup', function(e) {
187
-
188
- ajaxCloseAlert();
189
-
190
- var uuid = $(this).val();
191
- var my_url = '/custom_fields/check_object_exist';
192
- obj_type = document.getElementById("custom_field_object_type").value;
193
-
194
- $.ajax({
195
- url: my_url,
196
- type: "GET",
197
- dataType: "json",
198
- data: {
199
- uuid: $(this).val(),
200
- object_type: obj_type
201
- },
202
- success: function(data) {
203
- if (data.status == 431) {
204
- var msg = data["message"];
205
- ajaxErrorAlert(msg);
206
- }
207
- }
208
- });
209
-
210
-
211
- });
212
-
213
-
214
- /*
215
- * Validate external key
216
- */
217
- const VALIDATE_EXTERNAL_KEY = {
218
- account: { url: Routes.kaui_engine_accounts_validate_external_key_path(), invalid_msg_class_name: '.account_external_key_invalid_msg' },
219
- payment_method: {url: Routes.kaui_engine_payment_methods_validate_external_key_path(), invalid_msg_class_name: '.payment_method_external_key_invalid_msg'},
220
- bundle: {url: Routes.kaui_engine_subscriptions_validate_bundle_external_key_path(), invalid_msg_class_name: '.subscription_bundle_external_key_invalid_msg'},
221
- subscription: {url: Routes.kaui_engine_subscriptions_validate_external_key_path(), invalid_msg_class_name: '.subscription_external_key_invalid_msg'}
222
- }
223
-
224
- validate_external_key($('#account_external_key').val(),'account');
225
- $('#account_external_key').on('change', function(e){
226
- validate_external_key($(this).val(),'account');
227
- });
228
-
229
- validate_external_key($('#payment_method_external_key').val(),'payment_method');
230
- $('#payment_method_external_key').on('change', function(e){
231
- validate_external_key($(this).val(),'payment_method');
232
- });
233
-
234
- validate_external_key($('#bundle_external_key').val(),'bundle');
235
- $('#bundle_external_key').on('change', function(e){
236
- validate_external_key($(this).val(),'bundle');
237
- });
238
-
239
- validate_external_key($('#subscription_external_key').val(),'subscription');
240
- $('#subscription_external_key').on('change', function(e){
241
- validate_external_key($(this).val(),'subscription');
242
- });
243
-
244
- function validate_external_key(external_key, key_for){
245
- if (external_key == undefined || external_key == null || external_key.trim().length == 0){
246
- $(VALIDATE_EXTERNAL_KEY[key_for].invalid_msg_class_name).hide();
247
- }else {
248
- $.ajax(
249
- {
250
- url: VALIDATE_EXTERNAL_KEY[key_for].url,
251
- type: "GET",
252
- dataType: "json",
253
- data: {external_key: external_key},
254
- success: function (data) {
255
- if (data.is_found) {
256
- $(VALIDATE_EXTERNAL_KEY[key_for].invalid_msg_class_name).show();
257
- } else {
258
- $(VALIDATE_EXTERNAL_KEY[key_for].invalid_msg_class_name).hide();
259
- }
260
- }
261
- });
262
- }
263
- }
264
-
265
- // Restrict numeric input for a text field
266
- // Using "constraint validation API" to restrict input
267
- $("input[type=number]").keydown(function(event) {
268
- $(this).data('oldData', $(this).val());
269
- }).keyup(function(event) {
270
- if (event.currentTarget.validity.badInput) {
271
- $(this).val($(this).data('oldData'));
272
- }
273
- });
274
-
275
- // this will register a global ajax error for all jquery ajax requests (not including DataTable)
276
- $( document ).ajaxError(function( event, jqxhr, settings, thrownError ) {
277
- if (jqxhr.status == 0) {
278
- return;
279
- }
280
-
281
- var message = 'Request error: ' + getMessageFromResponse(jqxhr);
282
-
283
- if (jqxhr.status == 200) {
284
- message = thrownError.message == undefined ? thrownError : thrownError.message;
285
- }
286
- ajaxErrorAlert(message);
287
- });
288
-
289
- function getMessageFromResponse(jqxhr) {
290
- if (isBlank(jqxhr.responseJSON)) {
291
- return jqxhr.responseText;
292
- }
293
-
294
- if (!isBlank(jqxhr.responseJSON.error)) {
295
- return jqxhr.responseJSON.error;
296
- }
297
-
298
- return jqxhr.responseText;
299
- }
300
-
301
- // this will prevent DataTable to show an alert message box when an error occurs
302
- $.fn.dataTable.ext.errMode = 'none';
303
- // this will try to register a DataTable error event to all tables, and if an error occurs will display the error on screen
304
- $( document ).find(".table").on('error.dt', function ( e, settings, techNote, message ) {
305
- ajaxErrorAlert('An error has been reported by DataTables: ' + message);
306
- });
307
-
308
- setObjectIdPopover();
309
- });
310
-
311
-
312
- // global function used to show an error message that occurs on a Ajax call, if timeout is passed the box will disappear when the time is up.
313
- function ajaxErrorAlert(message, timeout) {
314
- ajaxAlert("ajaxErrorAlert", message, timeout);
315
- }
316
-
317
- // global function used to show an information message.
318
- function ajaxInfoAlert(message, timeout) {
319
- ajaxAlert("ajaxInfoAlert", message, timeout);
320
- }
321
-
322
- // if timeout is passed the box will disappear when the time is up.
323
- function ajaxAlert(alert_element_id, message, timeout) {
324
- // do not show ajax alert if there is already an server alert
325
- var serverAlertStatus = $(".server-alert").css("display");
326
- if (serverAlertStatus != undefined && serverAlertStatus != "none") {
327
- return;
328
- }
329
-
330
- var messageBox = $("#" + alert_element_id);
331
- messageBox.find("#" + alert_element_id + "Message").text(message);
332
- messageBox.show();
333
- messageBox.find("button").click(function(){
334
- ajaxCloseAlert(messageBox);
335
- });
336
-
337
- //if timeout is passed the box will disappear when the time is up
338
- if (!isBlank(timeout)) {
339
- setTimeout(function(){ ajaxCloseAlert()}, timeout);
340
- }
341
- }
342
-
343
- function ajaxCloseAlert(messageBox) {
344
- var messageBox = messageBox || $(".ajaxAlert");
345
- messageBox.find(".ajaxAlertMessage").text('');
346
- messageBox.hide();
347
- }
348
-
349
- // global helper function to validate if a variable is null or empty or undefined
350
- function isNullOrUndefined(value) {
351
- if (value == undefined || value == null) {
352
- return true;
353
- }
354
- return false;
355
- }
356
-
357
- function isBlank(value) {
358
- if (isNullOrUndefined(value)) {
359
- return true;
360
- }
361
-
362
- if (jQuery.type(value) === "string" && value.trim().length == 0) {
363
- return true;
364
- } else if (jQuery.type(value) === "array" && value.length == 0) {
365
- return true;
366
- } else if (jQuery.type(value) === "object" && jQuery.isEmptyObject(value)) {
367
- return true;
368
- } else {
369
- return false;
370
- }
371
- }
372
-
373
- // this function set popover for all tags that have class object-id-popover
374
- // attributes:
375
- // data-id = content of the popover,object id; required
376
- // title = title of the popover; not required
377
- // id = (must be {{id}}-popover) used to close popover when the copy image is clicked; if present; if not present a timeout of 5s will apply; not required
378
- function setObjectIdPopover(){
379
- $(".object-id-popover").each(function(idx, e){
380
- $(this).popover('destroy');
381
- $(this).off("shown.bs.popover");
382
- $(this).data("index", idx);
383
-
384
- $(this).popover({
385
- html: true,
386
- content: function() {
387
- var template = '<div class="{{id}}-content" >' +
388
- '{{id}}&emsp;<i id="{{id}}-copy" class="fa fa-clipboard copy-icon" aria-hidden="true"></i> ' +
389
- '<input id="{{id}}-placeholder" class="form-control hidden"> ' +
390
- '</div>';
391
-
392
- var popover_html = Mustache.render( template , { id: $(this).data("id") });
393
- return popover_html;
394
- },
395
- container: 'body',
396
- trigger: 'hover',
397
- delay: { "show": 100, "hide": 4000 }
398
- });
399
-
400
- $(this).on("show.bs.popover", function(e) {
401
- var currentPopoverIndex = $(this).data('index');
402
- $(".object-id-popover").each(function(idx, e){
403
- var index = $(this).data('index');
404
-
405
- if (currentPopoverIndex != index) {
406
- $(this).popover('hide');
407
- }
408
- });
409
- });
410
-
411
- $(this).on("shown.bs.popover", function(e) {
412
- var objectId = $(this).data('id');
413
- var copyIdImg = $("#" + objectId + "-copy");
414
-
415
- copyIdImg.data("popover",$(this).attr("id"));
416
- copyIdImg.click(function(e){
417
- var id = ($(this).attr("id")).replace('-copy','');
418
- var placeholder = $("#" + objectId + "-placeholder");
419
- var popover = $("#" + copyIdImg.data("popover"));
420
- placeholder.val(id);
421
- placeholder.removeClass("hidden");
422
- placeholder.select();
423
-
424
- document.execCommand("Copy");
425
- placeholder.addClass("hidden");
426
- ajaxInfoAlert("Id [" + id + "] was copied into the clipboard!", 4000);
427
-
428
- if (!isBlank(popover)) {
429
- popover.popover('hide');
430
- }
431
-
432
- });
433
-
434
- });
435
-
436
- });
437
-
438
- // close all object id popover on modal show
439
- $(".modal").on('show.bs.modal',function(e){
440
- $(".object-id-popover").each(function(idx, e) {
441
- $(this).popover('destroy');
442
- });
443
- });
444
-
445
- // check if object id must be restored
446
- $(".modal").on('hide.bs.modal',function(e){
447
- setObjectIdPopover();
448
- });
449
- }
450
-
451
-
452
-
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require_tree .