PluginProbe
Tiered Pricing Table for WooCommerce / 2.3.3
Tiered Pricing Table for WooCommerce v2.3.3
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / assets / admin / settings.js

settings.js in Tiered Pricing Table for WooCommerce 2.3.3, at assets/admin/settings.js

126 lines 5.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function ($) {
2 var TieredPricingSettings = function () {
3 this.init = function () {
4 this.prefix = 'tier_pricing_table_';
5
6 this.$displayType = this.getRow('display_type');
7 this.$displayAtCatalog = this.getRow('tiered_price_at_catalog');
8 this.$showDiscountColumn = this.getRow('show_discount_column');
9 this.$changePriceAtProductPage = this.getRow('tiered_price_at_product_page');
10 this.$showSummary = this.getRow('display_summary');
11 this.$summaryType = this.getRow('summary_type');
12
13 this.$showSummary.on('change', (function () {
14
15 this.$summaryType.trigger('change');
16
17 if (this.$showSummary.attr('checked')) {
18 this.showRow(this.getRow('summary_type'));
19 this.showRow(this.getRow('summary_title'));
20 this.showRow(this.getRow('summary_position_hook'));
21 } else {
22 this.hideRow(this.getRow('summary_type'));
23 this.hideRow(this.getRow('summary_title'));
24 this.hideRow(this.getRow('summary_position_hook'));
25 }
26
27 }).bind(this));
28
29 this.$summaryType.on('change', (function () {
30
31 if (this.$summaryType.val() === 'inline' && this.$showSummary.attr('checked')) {
32 this.showRow(this.getRow('summary_total_label'));
33 this.showRow(this.getRow('summary_each_label'));
34 } else {
35 this.hideRow(this.getRow('summary_total_label'));
36 this.hideRow(this.getRow('summary_each_label'));
37 }
38
39 }).bind(this));
40
41 this.$displayType.on('change', (function () {
42
43 if (this.$displayType.val() === 'tooltip') {
44 this.hideRow(this.getRow('position_hook'));
45 this.hideRow(this.getRow('table_title'));
46 this.showRow(this.getRow('tooltip_color'));
47 this.showRow(this.getRow('tooltip_size'));
48 this.showRow(this.getRow('tooltip_border'));
49 } else {
50 this.showRow(this.getRow('position_hook'));
51 this.showRow(this.getRow('table_title'));
52 this.hideRow(this.getRow('tooltip_size'));
53 this.hideRow(this.getRow('tooltip_color'));
54 this.hideRow(this.getRow('tooltip_border'));
55 }
56
57 }).bind(this));
58
59 this.getRow('tiered_price_at_catalog_type').on('change', (function (e) {
60 if ($(e.target).val() === 'lowest') {
61 this.showRow(this.getRow('lowest_prefix'));
62 } else {
63 this.hideRow(this.getRow('lowest_prefix'));
64 }
65 }).bind(this));
66
67 this.$displayAtCatalog.on('change', (function () {
68 if (this.$displayAtCatalog.attr('checked')) {
69 this.showRow(this.getRow('lowest_prefix'));
70 this.showRow(this.getRow('tiered_price_at_catalog_type'));
71 this.showRow(this.getRow('tiered_price_at_catalog_for_variable'));
72 this.showRow(this.getRow('tiered_price_at_product_page'));
73 } else {
74 this.hideRow(this.getRow('tiered_price_at_catalog_type'));
75 this.hideRow(this.getRow('tiered_price_at_catalog_for_variable'));
76 this.hideRow(this.getRow('tiered_price_at_product_page'));
77 this.hideRow(this.getRow('lowest_prefix'));
78 }
79 }).bind(this));
80
81 this.$showDiscountColumn.on('change', (function () {
82 if (this.$showDiscountColumn.attr('checked')) {
83 this.showRow(this.getRow('head_discount_text'));
84 } else {
85 this.hideRow(this.getRow('head_discount_text'));
86 }
87 }).bind(this));
88
89
90 this.$changePriceAtProductPage.on('change', (function () {
91 if (this.$changePriceAtProductPage.attr('checked')) {
92 this.hideRow(this.getRow('show_total_price'));
93 this.hideRow(this.getRow('clickable_table_rows'));
94 } else {
95 this.showRow(this.getRow('show_total_price'));
96 this.showRow(this.getRow('clickable_table_rows'));
97 }
98 }).bind(this));
99
100 this.$displayType.trigger('change');
101 this.$displayAtCatalog.trigger('change');
102 this.$showDiscountColumn.trigger('change');
103 this.$changePriceAtProductPage.trigger('change');
104 this.$showSummary.trigger('change');
105 this.$summaryType.trigger('change');
106
107 this.getRow('tiered_price_at_catalog_type').trigger('change');
108 };
109
110 this.showRow = function (el) {
111 el.closest('tr').show(100);
112 };
113
114 this.hideRow = function (el) {
115 el.closest('tr').hide(100);
116 };
117
118 this.getRow = function (settingsName) {
119 return $('[name=' + this.prefix + settingsName + ']');
120 }
121 };
122
123 var tieredPricingSettings = new TieredPricingSettings();
124
125 tieredPricingSettings.init();
126 });