Version Description
- Fix: woocommerce checkout datepicker required
Download this release
Release Info
Developer | quadlayers |
Plugin | WooCommerce Checkout Manager |
Version | 5.0.4 |
Comparing to | |
See all releases |
Code changes from version 5.0.3 to 5.0.4
- assets/backend/css/wooccm-admin.css +225 -225
- assets/backend/css/wooccm-admin.min.css +1 -1
- assets/backend/js/wooccm-admin-field.js +481 -481
- assets/backend/js/wooccm-admin.js +278 -278
- assets/frontend/css/wooccm.css +120 -120
- assets/frontend/css/wooccm.min.css +1 -1
- assets/frontend/js/wooccm-checkout.js +515 -515
- assets/frontend/js/wooccm-order-upload.js +134 -134
- includes/class-wooccm-compatibility.php +415 -415
- includes/class-wooccm-install.php +92 -92
- includes/class-wooccm-notices.php +166 -166
- includes/class-wooccm-suggestions-list-table.php +140 -140
- includes/class-wooccm-upload.php +159 -159
- includes/class-wooccm.php +140 -140
- includes/controller/class-wooccm-advanced.php +135 -135
- includes/controller/class-wooccm-checkout.php +393 -393
- includes/controller/class-wooccm-email.php +129 -129
- includes/controller/class-wooccm-field-additional.php +221 -221
- includes/controller/class-wooccm-field-billing.php +93 -93
- includes/controller/class-wooccm-field-shipping.php +93 -93
- includes/controller/class-wooccm-field.php +387 -387
- includes/controller/class-wooccm-order.php +310 -310
- includes/controller/class-wooccm-premium.php +57 -57
- includes/controller/class-wooccm-suggestions.php +62 -62
- includes/view/backend/meta-boxes/html-order-uploads.php +60 -60
- includes/view/backend/pages/additional.php +8 -8
- includes/view/backend/pages/billing.php +9 -9
- includes/view/backend/pages/modals/field.php +19 -19
- includes/view/backend/pages/modals/parts/info.php +76 -76
- includes/view/backend/pages/modals/parts/panel-admin.php +23 -23
- includes/view/backend/pages/modals/parts/panel-datepicker.php +63 -63
- includes/view/backend/pages/modals/parts/panel-display.php +33 -33
- includes/view/backend/pages/modals/parts/panel-filter.php +79 -79
- includes/view/backend/pages/modals/parts/panel-select2.php +39 -39
- includes/view/backend/pages/modals/parts/panel-timepicker.php +28 -28
- includes/view/backend/pages/parts/header.php +47 -47
- includes/view/backend/pages/parts/loop.php +129 -129
- includes/view/backend/pages/parts/tabs.php +4 -4
- includes/view/backend/pages/shipping.php +8 -8
- includes/view/frontend/class-wooccm-fields-handler.php +255 -255
- languages/woocommerce-checkout-manager.pot +1219 -1219
- readme.txt +4 -1
- templates/order/order-custom-fields.php +26 -26
- templates/order/order-upload-files.php +57 -57
- woocommerce-checkout-manager.php +2 -2
assets/backend/css/wooccm-admin.css
CHANGED
@@ -1,226 +1,226 @@
|
|
1 |
-
.select2-container {
|
2 |
-
z-index: 9999999;
|
3 |
-
}
|
4 |
-
.select2-container .select2-selection--single,
|
5 |
-
.select2-container .select2-selection--single .select2-selection__rendered,
|
6 |
-
.select2-container .select2-selection--single .select2-selection__arrow {
|
7 |
-
height: 30px!important;
|
8 |
-
line-height: 30px!important;
|
9 |
-
}
|
10 |
-
.wooccm-premium {
|
11 |
-
opacity: 0.5;
|
12 |
-
pointer-events: none;
|
13 |
-
/* .description {
|
14 |
-
&.premium {
|
15 |
-
//display: none;
|
16 |
-
}
|
17 |
-
|
18 |
-
&.hidden {
|
19 |
-
//display: none;
|
20 |
-
}
|
21 |
-
}*/
|
22 |
-
}
|
23 |
-
.button.fileinput-button {
|
24 |
-
position: relative;
|
25 |
-
overflow: hidden!important;
|
26 |
-
}
|
27 |
-
.button.fileinput-button input {
|
28 |
-
position: absolute;
|
29 |
-
top: 0;
|
30 |
-
right: 0;
|
31 |
-
margin: 0;
|
32 |
-
opacity: 0;
|
33 |
-
-ms-filter: 'alpha(opacity=0)';
|
34 |
-
font-size: 200px;
|
35 |
-
direction: ltr;
|
36 |
-
cursor: pointer;
|
37 |
-
}
|
38 |
-
table.wc_gateways > tbody > tr > td select {
|
39 |
-
line-height: 1!important;
|
40 |
-
}
|
41 |
-
table.wc_gateways > tbody > tr > td.label {
|
42 |
-
font-weight: 600;
|
43 |
-
}
|
44 |
-
table.wooccm-enhanced-options {
|
45 |
-
border: none;
|
46 |
-
box-shadow: none;
|
47 |
-
}
|
48 |
-
table.wooccm-enhanced-options > thead > th .woocommerce-help-tip {
|
49 |
-
margin: -1px 0 0 0.25em;
|
50 |
-
}
|
51 |
-
table.wooccm-enhanced-options > tbody > tr > td input.label {
|
52 |
-
width: 100%;
|
53 |
-
}
|
54 |
-
table.wooccm-enhanced-options > tbody > tr > td select.add-price-type {
|
55 |
-
margin: 0 0 0 10px;
|
56 |
-
}
|
57 |
-
table.wooccm-enhanced-options > tbody > tr > td input.check {
|
58 |
-
margin: 0 9px;
|
59 |
-
}
|
60 |
-
table.wooccm-enhanced-options > tbody > tr > td.sort .wc-item-reorder-nav {
|
61 |
-
width: auto;
|
62 |
-
}
|
63 |
-
#wooccm_modal.processing {
|
64 |
-
pointer-events: none;
|
65 |
-
}
|
66 |
-
#wooccm_modal.processing:before {
|
67 |
-
content: '';
|
68 |
-
position: absolute;
|
69 |
-
top: 0;
|
70 |
-
bottom: 0;
|
71 |
-
left: 0;
|
72 |
-
right: 0;
|
73 |
-
background-color: #ffffff;
|
74 |
-
z-index: 99999999;
|
75 |
-
opacity: 0.8;
|
76 |
-
}
|
77 |
-
#wooccm_modal select {
|
78 |
-
min-height: 30px;
|
79 |
-
}
|
80 |
-
#wooccm_modal .form-field .wrap {
|
81 |
-
padding: 0;
|
82 |
-
}
|
83 |
-
#wooccm_modal .attachment-info .details,
|
84 |
-
#wooccm_modal .attachment-info .settings {
|
85 |
-
width: 100%;
|
86 |
-
}
|
87 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel label,
|
88 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel legend {
|
89 |
-
width: 75px;
|
90 |
-
margin: 0 0 0 -90px;
|
91 |
-
font-weight: 600;
|
92 |
-
}
|
93 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,
|
94 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field {
|
95 |
-
padding: 0 20px 0 92px!important;
|
96 |
-
}
|
97 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],
|
98 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],
|
99 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],
|
100 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],
|
101 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel select,
|
102 |
-
#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container {
|
103 |
-
width: 100%!important;
|
104 |
-
}
|
105 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel {
|
106 |
-
width: 100%;
|
107 |
-
/* input,
|
108 |
-
select,
|
109 |
-
textarea {
|
110 |
-
margin: 0;
|
111 |
-
}*/
|
112 |
-
}
|
113 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium {
|
114 |
-
display: block;
|
115 |
-
clear: both;
|
116 |
-
}
|
117 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip {
|
118 |
-
margin: 0 0 0 0.5em;
|
119 |
-
}
|
120 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
121 |
-
width: 50%!important;
|
122 |
-
line-height: 16px;
|
123 |
-
}
|
124 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection {
|
125 |
-
box-shadow: none;
|
126 |
-
border-radius: 3px;
|
127 |
-
padding: 0 24px 0 8px;
|
128 |
-
}
|
129 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple {
|
130 |
-
line-height: 16px;
|
131 |
-
min-height: 30px;
|
132 |
-
}
|
133 |
-
@media only screen and (max-width: 1280px) {
|
134 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
135 |
-
width: 80%!important;
|
136 |
-
}
|
137 |
-
}
|
138 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
139 |
-
margin: 3px 3px 0 0;
|
140 |
-
}
|
141 |
-
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple {
|
142 |
-
border-color: #5b9dd9!important;
|
143 |
-
box-shadow: 0 0 2px rgba(30, 140, 190, 0.8) !important;
|
144 |
-
outline: 2px solid transparent!important;
|
145 |
-
}
|
146 |
-
#wooccm-order-files .inside {
|
147 |
-
margin: 0;
|
148 |
-
padding: 0;
|
149 |
-
background: #fefefe;
|
150 |
-
display: block!important;
|
151 |
-
}
|
152 |
-
#wooccm-order-files .handlediv,
|
153 |
-
#wooccm-order-files .hndle {
|
154 |
-
display: none;
|
155 |
-
}
|
156 |
-
#wooccm-order-files .wooccm_upload_results {
|
157 |
-
display: inline-block;
|
158 |
-
margin: 0 10px;
|
159 |
-
}
|
160 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper {
|
161 |
-
margin: 0;
|
162 |
-
overflow-x: auto;
|
163 |
-
}
|
164 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments {
|
165 |
-
width: 100%;
|
166 |
-
background: #fff;
|
167 |
-
}
|
168 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child {
|
169 |
-
padding-left: 2em;
|
170 |
-
}
|
171 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable {
|
172 |
-
cursor: pointer;
|
173 |
-
}
|
174 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item {
|
175 |
-
min-width: 200px;
|
176 |
-
}
|
177 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th {
|
178 |
-
text-align: left;
|
179 |
-
padding: 1em;
|
180 |
-
font-weight: 400;
|
181 |
-
color: #999;
|
182 |
-
background: #f8f8f8;
|
183 |
-
user-select: none;
|
184 |
-
}
|
185 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td {
|
186 |
-
border-top: none;
|
187 |
-
}
|
188 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td {
|
189 |
-
border-bottom: 1px solid #dfdfdf;
|
190 |
-
}
|
191 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb {
|
192 |
-
text-align: left;
|
193 |
-
width: 38px;
|
194 |
-
padding-bottom: 1.5em;
|
195 |
-
}
|
196 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail {
|
197 |
-
width: 38px;
|
198 |
-
height: 38px;
|
199 |
-
border: 2px solid #e8e8e8;
|
200 |
-
background: #f8f8f8;
|
201 |
-
color: #ccc;
|
202 |
-
position: relative;
|
203 |
-
font-size: 21px;
|
204 |
-
display: block;
|
205 |
-
text-align: center;
|
206 |
-
}
|
207 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,
|
208 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child {
|
209 |
-
padding-left: 2em;
|
210 |
-
}
|
211 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,
|
212 |
-
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td {
|
213 |
-
padding: 1.5em 1em 1em;
|
214 |
-
text-align: left;
|
215 |
-
line-height: 1.5em;
|
216 |
-
vertical-align: top;
|
217 |
-
border-bottom: 1px solid #f8f8f8;
|
218 |
-
}
|
219 |
-
#wooccm-order-files .wc-order-data-row {
|
220 |
-
border-bottom: 1px solid #dfdfdf;
|
221 |
-
padding: 1.5em 2em;
|
222 |
-
background: #f8f8f8;
|
223 |
-
line-height: 2em;
|
224 |
-
text-align: left;
|
225 |
-
}
|
226 |
/*# sourceMappingURL=wooccm-admin.css.map */
|
1 |
+
.select2-container {
|
2 |
+
z-index: 9999999;
|
3 |
+
}
|
4 |
+
.select2-container .select2-selection--single,
|
5 |
+
.select2-container .select2-selection--single .select2-selection__rendered,
|
6 |
+
.select2-container .select2-selection--single .select2-selection__arrow {
|
7 |
+
height: 30px!important;
|
8 |
+
line-height: 30px!important;
|
9 |
+
}
|
10 |
+
.wooccm-premium {
|
11 |
+
opacity: 0.5;
|
12 |
+
pointer-events: none;
|
13 |
+
/* .description {
|
14 |
+
&.premium {
|
15 |
+
//display: none;
|
16 |
+
}
|
17 |
+
|
18 |
+
&.hidden {
|
19 |
+
//display: none;
|
20 |
+
}
|
21 |
+
}*/
|
22 |
+
}
|
23 |
+
.button.fileinput-button {
|
24 |
+
position: relative;
|
25 |
+
overflow: hidden!important;
|
26 |
+
}
|
27 |
+
.button.fileinput-button input {
|
28 |
+
position: absolute;
|
29 |
+
top: 0;
|
30 |
+
right: 0;
|
31 |
+
margin: 0;
|
32 |
+
opacity: 0;
|
33 |
+
-ms-filter: 'alpha(opacity=0)';
|
34 |
+
font-size: 200px;
|
35 |
+
direction: ltr;
|
36 |
+
cursor: pointer;
|
37 |
+
}
|
38 |
+
table.wc_gateways > tbody > tr > td select {
|
39 |
+
line-height: 1!important;
|
40 |
+
}
|
41 |
+
table.wc_gateways > tbody > tr > td.label {
|
42 |
+
font-weight: 600;
|
43 |
+
}
|
44 |
+
table.wooccm-enhanced-options {
|
45 |
+
border: none;
|
46 |
+
box-shadow: none;
|
47 |
+
}
|
48 |
+
table.wooccm-enhanced-options > thead > th .woocommerce-help-tip {
|
49 |
+
margin: -1px 0 0 0.25em;
|
50 |
+
}
|
51 |
+
table.wooccm-enhanced-options > tbody > tr > td input.label {
|
52 |
+
width: 100%;
|
53 |
+
}
|
54 |
+
table.wooccm-enhanced-options > tbody > tr > td select.add-price-type {
|
55 |
+
margin: 0 0 0 10px;
|
56 |
+
}
|
57 |
+
table.wooccm-enhanced-options > tbody > tr > td input.check {
|
58 |
+
margin: 0 9px;
|
59 |
+
}
|
60 |
+
table.wooccm-enhanced-options > tbody > tr > td.sort .wc-item-reorder-nav {
|
61 |
+
width: auto;
|
62 |
+
}
|
63 |
+
#wooccm_modal.processing {
|
64 |
+
pointer-events: none;
|
65 |
+
}
|
66 |
+
#wooccm_modal.processing:before {
|
67 |
+
content: '';
|
68 |
+
position: absolute;
|
69 |
+
top: 0;
|
70 |
+
bottom: 0;
|
71 |
+
left: 0;
|
72 |
+
right: 0;
|
73 |
+
background-color: #ffffff;
|
74 |
+
z-index: 99999999;
|
75 |
+
opacity: 0.8;
|
76 |
+
}
|
77 |
+
#wooccm_modal select {
|
78 |
+
min-height: 30px;
|
79 |
+
}
|
80 |
+
#wooccm_modal .form-field .wrap {
|
81 |
+
padding: 0;
|
82 |
+
}
|
83 |
+
#wooccm_modal .attachment-info .details,
|
84 |
+
#wooccm_modal .attachment-info .settings {
|
85 |
+
width: 100%;
|
86 |
+
}
|
87 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel label,
|
88 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel legend {
|
89 |
+
width: 75px;
|
90 |
+
margin: 0 0 0 -90px;
|
91 |
+
font-weight: 600;
|
92 |
+
}
|
93 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,
|
94 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field {
|
95 |
+
padding: 0 20px 0 92px!important;
|
96 |
+
}
|
97 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],
|
98 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],
|
99 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],
|
100 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],
|
101 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel select,
|
102 |
+
#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container {
|
103 |
+
width: 100%!important;
|
104 |
+
}
|
105 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel {
|
106 |
+
width: 100%;
|
107 |
+
/* input,
|
108 |
+
select,
|
109 |
+
textarea {
|
110 |
+
margin: 0;
|
111 |
+
}*/
|
112 |
+
}
|
113 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium {
|
114 |
+
display: block;
|
115 |
+
clear: both;
|
116 |
+
}
|
117 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip {
|
118 |
+
margin: 0 0 0 0.5em;
|
119 |
+
}
|
120 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
121 |
+
width: 50%!important;
|
122 |
+
line-height: 16px;
|
123 |
+
}
|
124 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection {
|
125 |
+
box-shadow: none;
|
126 |
+
border-radius: 3px;
|
127 |
+
padding: 0 24px 0 8px;
|
128 |
+
}
|
129 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple {
|
130 |
+
line-height: 16px;
|
131 |
+
min-height: 30px;
|
132 |
+
}
|
133 |
+
@media only screen and (max-width: 1280px) {
|
134 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container {
|
135 |
+
width: 80%!important;
|
136 |
+
}
|
137 |
+
}
|
138 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
139 |
+
margin: 3px 3px 0 0;
|
140 |
+
}
|
141 |
+
#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple {
|
142 |
+
border-color: #5b9dd9!important;
|
143 |
+
box-shadow: 0 0 2px rgba(30, 140, 190, 0.8) !important;
|
144 |
+
outline: 2px solid transparent!important;
|
145 |
+
}
|
146 |
+
#wooccm-order-files .inside {
|
147 |
+
margin: 0;
|
148 |
+
padding: 0;
|
149 |
+
background: #fefefe;
|
150 |
+
display: block!important;
|
151 |
+
}
|
152 |
+
#wooccm-order-files .handlediv,
|
153 |
+
#wooccm-order-files .hndle {
|
154 |
+
display: none;
|
155 |
+
}
|
156 |
+
#wooccm-order-files .wooccm_upload_results {
|
157 |
+
display: inline-block;
|
158 |
+
margin: 0 10px;
|
159 |
+
}
|
160 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper {
|
161 |
+
margin: 0;
|
162 |
+
overflow-x: auto;
|
163 |
+
}
|
164 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments {
|
165 |
+
width: 100%;
|
166 |
+
background: #fff;
|
167 |
+
}
|
168 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child {
|
169 |
+
padding-left: 2em;
|
170 |
+
}
|
171 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable {
|
172 |
+
cursor: pointer;
|
173 |
+
}
|
174 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item {
|
175 |
+
min-width: 200px;
|
176 |
+
}
|
177 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th {
|
178 |
+
text-align: left;
|
179 |
+
padding: 1em;
|
180 |
+
font-weight: 400;
|
181 |
+
color: #999;
|
182 |
+
background: #f8f8f8;
|
183 |
+
user-select: none;
|
184 |
+
}
|
185 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td {
|
186 |
+
border-top: none;
|
187 |
+
}
|
188 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td {
|
189 |
+
border-bottom: 1px solid #dfdfdf;
|
190 |
+
}
|
191 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb {
|
192 |
+
text-align: left;
|
193 |
+
width: 38px;
|
194 |
+
padding-bottom: 1.5em;
|
195 |
+
}
|
196 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail {
|
197 |
+
width: 38px;
|
198 |
+
height: 38px;
|
199 |
+
border: 2px solid #e8e8e8;
|
200 |
+
background: #f8f8f8;
|
201 |
+
color: #ccc;
|
202 |
+
position: relative;
|
203 |
+
font-size: 21px;
|
204 |
+
display: block;
|
205 |
+
text-align: center;
|
206 |
+
}
|
207 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,
|
208 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child {
|
209 |
+
padding-left: 2em;
|
210 |
+
}
|
211 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,
|
212 |
+
#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td {
|
213 |
+
padding: 1.5em 1em 1em;
|
214 |
+
text-align: left;
|
215 |
+
line-height: 1.5em;
|
216 |
+
vertical-align: top;
|
217 |
+
border-bottom: 1px solid #f8f8f8;
|
218 |
+
}
|
219 |
+
#wooccm-order-files .wc-order-data-row {
|
220 |
+
border-bottom: 1px solid #dfdfdf;
|
221 |
+
padding: 1.5em 2em;
|
222 |
+
background: #f8f8f8;
|
223 |
+
line-height: 2em;
|
224 |
+
text-align: left;
|
225 |
+
}
|
226 |
/*# sourceMappingURL=wooccm-admin.css.map */
|
assets/backend/css/wooccm-admin.min.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
|
2 |
.select2-container{z-index:9999999}.select2-container .select2-selection--single,.select2-container .select2-selection--single .select2-selection__rendered,.select2-container .select2-selection--single .select2-selection__arrow{height:30px!important;line-height:30px!important}.wooccm-premium{opacity:.5;pointer-events:none}.button.fileinput-button{position:relative;overflow:hidden!important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}table.wc_gateways>tbody>tr>td select{line-height:1!important}table.wc_gateways>tbody>tr>td.label{font-weight:600}table.wooccm-enhanced-options{border:0;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 0 .25em}table.wooccm-enhanced-options>tbody>tr>td input.label{width:100%}table.wooccm-enhanced-options>tbody>tr>td select.add-price-type{margin:0 0 0 10px}table.wooccm-enhanced-options>tbody>tr>td input.check{margin:0 9px}table.wooccm-enhanced-options>tbody>tr>td.sort .wc-item-reorder-nav{width:auto}#wooccm_modal.processing{pointer-events:none}#wooccm_modal.processing:before{content:'';position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;z-index:99999999;opacity:.8}#wooccm_modal select{min-height:30px}#wooccm_modal .form-field .wrap{padding:0}#wooccm_modal .attachment-info .details,#wooccm_modal .attachment-info .settings{width:100%}#wooccm_modal .attachment-info .woocommerce_options_panel label,#wooccm_modal .attachment-info .woocommerce_options_panel legend{width:75px;margin:0 0 0 -90px;font-weight:600}#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field{padding:0 20px 0 92px!important}#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],#wooccm_modal .attachment-info .woocommerce_options_panel select,#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container{width:100%!important}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel{width:100%}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium{display:block;clear:both}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip{margin:0 0 0 .5em}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:50%!important;line-height:16px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection{box-shadow:none;border-radius:3px;padding:0 24px 0 8px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple{line-height:16px;min-height:30px}@media only screen and (max-width:1280px){#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:80%!important}}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li{margin:3px 3px 0 0}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#5b9dd9!important;box-shadow:0 0 2px rgba(30,140,190,0.8)!important;outline:2px solid transparent!important}#wooccm-order-files .inside{margin:0;padding:0;background:#fefefe;display:block!important}#wooccm-order-files .handlediv,#wooccm-order-files .hndle{display:none}#wooccm-order-files .wooccm_upload_results{display:inline-block;margin:0 10px}#wooccm-order-files .wooccm_order_attachments_wrapper{margin:0;overflow-x:auto}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments{width:100%;background:#fff}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable{cursor:pointer}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item{min-width:200px}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th{text-align:left;padding:1em;font-weight:400;color:#999;background:#f8f8f8;user-select:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td{border-top:0}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td{border-bottom:1px solid #dfdfdf}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb{text-align:left;width:38px;padding-bottom:1.5em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail{width:38px;height:38px;border:2px solid #e8e8e8;background:#f8f8f8;color:#ccc;position:relative;font-size:21px;display:block;text-align:center}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td{padding:1.5em 1em 1em;text-align:left;line-height:1.5em;vertical-align:top;border-bottom:1px solid #f8f8f8}#wooccm-order-files .wc-order-data-row{border-bottom:1px solid #dfdfdf;padding:1.5em 2em;background:#f8f8f8;line-height:2em;text-align:left}
|
1 |
+
|
2 |
.select2-container{z-index:9999999}.select2-container .select2-selection--single,.select2-container .select2-selection--single .select2-selection__rendered,.select2-container .select2-selection--single .select2-selection__arrow{height:30px!important;line-height:30px!important}.wooccm-premium{opacity:.5;pointer-events:none}.button.fileinput-button{position:relative;overflow:hidden!important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}table.wc_gateways>tbody>tr>td select{line-height:1!important}table.wc_gateways>tbody>tr>td.label{font-weight:600}table.wooccm-enhanced-options{border:0;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 0 .25em}table.wooccm-enhanced-options>tbody>tr>td input.label{width:100%}table.wooccm-enhanced-options>tbody>tr>td select.add-price-type{margin:0 0 0 10px}table.wooccm-enhanced-options>tbody>tr>td input.check{margin:0 9px}table.wooccm-enhanced-options>tbody>tr>td.sort .wc-item-reorder-nav{width:auto}#wooccm_modal.processing{pointer-events:none}#wooccm_modal.processing:before{content:'';position:absolute;top:0;bottom:0;left:0;right:0;background-color:#fff;z-index:99999999;opacity:.8}#wooccm_modal select{min-height:30px}#wooccm_modal .form-field .wrap{padding:0}#wooccm_modal .attachment-info .details,#wooccm_modal .attachment-info .settings{width:100%}#wooccm_modal .attachment-info .woocommerce_options_panel label,#wooccm_modal .attachment-info .woocommerce_options_panel legend{width:75px;margin:0 0 0 -90px;font-weight:600}#wooccm_modal .attachment-info .woocommerce_options_panel fieldset.form-field,#wooccm_modal .attachment-info .woocommerce_options_panel p.form-field{padding:0 20px 0 92px!important}#wooccm_modal .attachment-info .woocommerce_options_panel input[type=email],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=number],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=password],#wooccm_modal .attachment-info .woocommerce_options_panel input[type=text],#wooccm_modal .attachment-info .woocommerce_options_panel select,#wooccm_modal .attachment-info .woocommerce_options_panel .select2-container{width:100%!important}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel{width:100%}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .premium{display:block;clear:both}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .woocommerce-help-tip{margin:0 0 0 .5em}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:50%!important;line-height:16px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection{box-shadow:none;border-radius:3px;padding:0 24px 0 8px}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container .select2-selection--multiple{line-height:16px;min-height:30px}@media only screen and (max-width:1280px){#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container{width:80%!important}}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default .select2-selection--multiple .select2-selection__rendered li{margin:3px 3px 0 0}#wooccm_modal #woocommerce-product-data .woocommerce_options_panel .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#5b9dd9!important;box-shadow:0 0 2px rgba(30,140,190,0.8)!important;outline:2px solid transparent!important}#wooccm-order-files .inside{margin:0;padding:0;background:#fefefe;display:block!important}#wooccm-order-files .handlediv,#wooccm-order-files .hndle{display:none}#wooccm-order-files .wooccm_upload_results{display:inline-block;margin:0 10px}#wooccm-order-files .wooccm_order_attachments_wrapper{margin:0;overflow-x:auto}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments{width:100%;background:#fff}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th.sortable{cursor:pointer}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments .item{min-width:200px}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments thead th{text-align:left;padding:1em;font-weight:400;color:#999;background:#f8f8f8;user-select:none}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody#order_line_items tr:first-child td{border-top:0}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody tr:last-child td{border-bottom:1px solid #dfdfdf}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb{text-align:left;width:38px;padding-bottom:1.5em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td.thumb .wc-order-item-thumbnail{width:38px;height:38px;border:2px solid #e8e8e8;background:#f8f8f8;color:#ccc;position:relative;font-size:21px;display:block;text-align:center}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th:first-child,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td:first-child{padding-left:2em}#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments tbody th,#wooccm-order-files .wooccm_order_attachments_wrapper table.wooccm_order_attachments td{padding:1.5em 1em 1em;text-align:left;line-height:1.5em;vertical-align:top;border-bottom:1px solid #f8f8f8}#wooccm-order-files .wc-order-data-row{border-bottom:1px solid #dfdfdf;padding:1.5em 2em;background:#f8f8f8;line-height:2em;text-align:left}
|
assets/backend/js/wooccm-admin-field.js
CHANGED
@@ -1,482 +1,482 @@
|
|
1 |
-
(function ($) {
|
2 |
-
|
3 |
-
var count = 0,
|
4 |
-
timer;
|
5 |
-
|
6 |
-
var is_blocked = function ($node) {
|
7 |
-
return $node.is('.processing') || $node.parents('.processing').length;
|
8 |
-
};
|
9 |
-
var block = function () {
|
10 |
-
$('#wooccm_modal').addClass('processing');
|
11 |
-
};
|
12 |
-
var unblock = function () {
|
13 |
-
$('#wooccm_modal').removeClass('processing');
|
14 |
-
};
|
15 |
-
|
16 |
-
_.mixin({
|
17 |
-
sortOptions: function (object) {
|
18 |
-
return _.sortBy(object, function (o) {
|
19 |
-
return o.order;
|
20 |
-
});
|
21 |
-
}
|
22 |
-
});
|
23 |
-
var FieldViewTabs = Backbone.View.extend({
|
24 |
-
templates: {},
|
25 |
-
initialize: function () {
|
26 |
-
this.templates.window = wp.template('wooccm-modal-tabs');
|
27 |
-
},
|
28 |
-
render: function () {
|
29 |
-
this.model.attributes.panel = 'general';
|
30 |
-
this.$el.html(this.templates.window(this.model.attributes));
|
31 |
-
//this.$el.trigger('wooccm-tab-panels');
|
32 |
-
}
|
33 |
-
});
|
34 |
-
var FieldViewPanels = Backbone.View.extend({
|
35 |
-
templates: {},
|
36 |
-
initialize: function () {
|
37 |
-
this.templates.window = wp.template('wooccm-modal-panels');
|
38 |
-
},
|
39 |
-
render: function () {
|
40 |
-
this.$el.html(this.templates.window(this.model.attributes));
|
41 |
-
this.$el.trigger('wooccm-enhanced-options');
|
42 |
-
this.$el.trigger('wooccm-enhanced-select');
|
43 |
-
this.$el.trigger('init_tooltips');
|
44 |
-
}
|
45 |
-
});
|
46 |
-
var FieldViewInfo = Backbone.View.extend({
|
47 |
-
templates: {},
|
48 |
-
initialize: function () {
|
49 |
-
this.templates.window = wp.template('wooccm-modal-info');
|
50 |
-
},
|
51 |
-
render: function () {
|
52 |
-
this.$el.html(this.templates.window(this.model.attributes));
|
53 |
-
this.$el.trigger('wooccm-enhanced-select');
|
54 |
-
this.$el.trigger('init_tooltips');
|
55 |
-
}
|
56 |
-
});
|
57 |
-
var FieldView = Backbone.View.extend({
|
58 |
-
events: {
|
59 |
-
'change input': 'enableSave',
|
60 |
-
'change textarea': 'enableSave',
|
61 |
-
'change select': 'enableSave',
|
62 |
-
'click .media-modal-backdrop': 'close',
|
63 |
-
'click .media-modal-close': 'close',
|
64 |
-
'click .media-modal-prev': 'edit',
|
65 |
-
'click .media-modal-next': 'edit',
|
66 |
-
'click .media-modal-tab': 'tab',
|
67 |
-
'change .media-modal-parent': 'parent',
|
68 |
-
'change .media-modal-render-tabs': 'renderTabs',
|
69 |
-
'change .media-modal-render-panels': 'renderPanels',
|
70 |
-
'change .media-modal-render-info': 'renderInfo',
|
71 |
-
'submit .media-modal-form': 'submit',
|
72 |
-
},
|
73 |
-
templates: {},
|
74 |
-
initialize: function () {
|
75 |
-
_.bindAll(this, 'tab', 'open', 'edit', 'parent', 'load', 'render', 'close', 'submit');
|
76 |
-
this.init();
|
77 |
-
this.open();
|
78 |
-
},
|
79 |
-
init: function () {
|
80 |
-
this.templates.window = wp.template('wooccm-modal-main');
|
81 |
-
},
|
82 |
-
assign: function (view, selector) {
|
83 |
-
view.setElement(this.$(selector)).render();
|
84 |
-
},
|
85 |
-
render: function () {
|
86 |
-
var modal = this;
|
87 |
-
modal.$el.html(modal.templates.window(modal.model.attributes));
|
88 |
-
this.tabs = new FieldViewTabs({model: modal.model});
|
89 |
-
this.panels = new FieldViewPanels({model: modal.model});
|
90 |
-
this.info = new FieldViewInfo({model: modal.model});
|
91 |
-
this.assign(this.tabs, '#wooccm-modal-tabs');
|
92 |
-
this.assign(this.panels, '#wooccm-modal-panels');
|
93 |
-
this.assign(this.info, '#wooccm-modal-info');
|
94 |
-
},
|
95 |
-
load: function () {
|
96 |
-
|
97 |
-
var modal = this;
|
98 |
-
|
99 |
-
block();
|
100 |
-
|
101 |
-
$.ajax({
|
102 |
-
url: wooccm_field.ajax_url,
|
103 |
-
data: {
|
104 |
-
action: 'wooccm_load_field',
|
105 |
-
nonce: wooccm_field.nonce,
|
106 |
-
field_id: this.model.attributes.id
|
107 |
-
},
|
108 |
-
dataType: 'json',
|
109 |
-
type: 'POST',
|
110 |
-
beforeSend: function () {
|
111 |
-
},
|
112 |
-
complete: function () {
|
113 |
-
unblock();
|
114 |
-
},
|
115 |
-
error: function () {
|
116 |
-
alert('Error!');
|
117 |
-
},
|
118 |
-
success: function (response) {
|
119 |
-
if (response.success) {
|
120 |
-
modal.model.set(response.data);
|
121 |
-
modal.render();
|
122 |
-
} else {
|
123 |
-
alert(response.data);
|
124 |
-
}
|
125 |
-
}
|
126 |
-
});
|
127 |
-
},
|
128 |
-
edit: function (e) {
|
129 |
-
e.preventDefault();
|
130 |
-
var modal = this,
|
131 |
-
$button = $(e.target),
|
132 |
-
field_count = parseInt($('.wc_gateways tr[data-field_id]').length),
|
133 |
-
order = parseInt(modal.model.get('order'));
|
134 |
-
count++;
|
135 |
-
if (timer) {
|
136 |
-
clearTimeout(timer);
|
137 |
-
}
|
138 |
-
|
139 |
-
timer = setTimeout(function () {
|
140 |
-
|
141 |
-
if ($button.hasClass('media-modal-next')) {
|
142 |
-
order = Math.min(order + count, field_count);
|
143 |
-
} else {
|
144 |
-
order = Math.max(order - count, 1);
|
145 |
-
}
|
146 |
-
|
147 |
-
modal.model.set({
|
148 |
-
id: parseInt($('.wc_gateways tr[data-field_order=' + order + ']').data('field_id'))
|
149 |
-
});
|
150 |
-
count = 0;
|
151 |
-
modal.load();
|
152 |
-
}, 300);
|
153 |
-
},
|
154 |
-
open: function (e) {
|
155 |
-
$('body').addClass('modal-open').append(this.$el);
|
156 |
-
if (this.model.attributes.id == undefined) {
|
157 |
-
_.delay(function () {
|
158 |
-
unblock();
|
159 |
-
}, 100);
|
160 |
-
return;
|
161 |
-
}
|
162 |
-
this.load();
|
163 |
-
},
|
164 |
-
updateModel: function (e) {
|
165 |
-
e.preventDefault();
|
166 |
-
|
167 |
-
var $field = $(e.target),
|
168 |
-
name = $field.attr('name'),
|
169 |
-
value = $field.val();
|
170 |
-
|
171 |
-
if (e.target.type === 'checkbox') {
|
172 |
-
value = $field.prop('checked') === true ? 1 : 0;
|
173 |
-
}
|
174 |
-
|
175 |
-
this.model.attributes[name] = value;
|
176 |
-
this.model.changed[name] = value;
|
177 |
-
},
|
178 |
-
tab: function (e) {
|
179 |
-
e.preventDefault();
|
180 |
-
|
181 |
-
var modal = this,
|
182 |
-
$modal = modal.$el.find('#wooccm_modal'),
|
183 |
-
$tab = $(e.currentTarget),
|
184 |
-
$tabs = $modal.find('ul.wc-tabs'),
|
185 |
-
panel = $tab.find('a').attr('href').replace('#', '');
|
186 |
-
|
187 |
-
$tabs.find('.active').removeClass('active');
|
188 |
-
$tab.addClass('active');
|
189 |
-
|
190 |
-
this.model.attributes['panel'] = panel;
|
191 |
-
this.model.changed['panel'] = panel;
|
192 |
-
|
193 |
-
this.renderPanels(e);
|
194 |
-
},
|
195 |
-
renderTabs: function (e) {
|
196 |
-
this.renderPanels(e);
|
197 |
-
this.tabs.render();
|
198 |
-
},
|
199 |
-
renderPanels: function (e) {
|
200 |
-
this.updateModel(e);
|
201 |
-
this.panels.render();
|
202 |
-
},
|
203 |
-
renderInfo: function () {
|
204 |
-
this.info.render();
|
205 |
-
},
|
206 |
-
close: function (e) {
|
207 |
-
e.preventDefault();
|
208 |
-
this.undelegateEvents();
|
209 |
-
$(document).off('focusin');
|
210 |
-
$('body').removeClass('modal-open');
|
211 |
-
this.remove();
|
212 |
-
},
|
213 |
-
parent: function (e) {
|
214 |
-
e.preventDefault();
|
215 |
-
var modal = this,
|
216 |
-
$modal = modal.$el.find('#wooccm_modal'),
|
217 |
-
$details = $modal.find('.attachment-details');
|
218 |
-
this.updateModel(e);
|
219 |
-
$.ajax({
|
220 |
-
url: wooccm_field.ajax_url,
|
221 |
-
data: {
|
222 |
-
action: 'wooccm_load_parent',
|
223 |
-
nonce: wooccm_field.nonce,
|
224 |
-
conditional_parent_key: modal.model.attributes.conditional_parent_key
|
225 |
-
},
|
226 |
-
dataType: 'json',
|
227 |
-
type: 'POST',
|
228 |
-
beforeSend: function () {
|
229 |
-
modal.disableSave();
|
230 |
-
$details.addClass('save-waiting');
|
231 |
-
},
|
232 |
-
complete: function () {
|
233 |
-
$details.addClass('save-complete');
|
234 |
-
$details.removeClass('save-waiting');
|
235 |
-
modal.enableSave();
|
236 |
-
},
|
237 |
-
error: function () {
|
238 |
-
alert('Error!');
|
239 |
-
},
|
240 |
-
success: function (response) {
|
241 |
-
if (response.success) {
|
242 |
-
modal.model.attributes['parent'] = response.data;
|
243 |
-
modal.model.changed['parent'] = response.data;
|
244 |
-
modal.renderInfo();
|
245 |
-
} else {
|
246 |
-
alert(response.data);
|
247 |
-
}
|
248 |
-
}
|
249 |
-
});
|
250 |
-
return false;
|
251 |
-
},
|
252 |
-
reload: function (e) {
|
253 |
-
if (this.$el.find('#wooccm_modal').hasClass('reload')) {
|
254 |
-
location.reload();
|
255 |
-
return;
|
256 |
-
}
|
257 |
-
this.remove();
|
258 |
-
return;
|
259 |
-
},
|
260 |
-
close: function (e) {
|
261 |
-
e.preventDefault();
|
262 |
-
this.undelegateEvents();
|
263 |
-
$(document).off('focusin');
|
264 |
-
$('body').removeClass('modal-open');
|
265 |
-
this.reload(e);
|
266 |
-
return;
|
267 |
-
},
|
268 |
-
enableSave: function (e) {
|
269 |
-
$('.media-modal-submit').removeProp('disabled');
|
270 |
-
},
|
271 |
-
disableSave: function (e) {
|
272 |
-
$('.media-modal-submit').prop('disabled', true);
|
273 |
-
},
|
274 |
-
submit: function (e) {
|
275 |
-
e.preventDefault();
|
276 |
-
var modal = this,
|
277 |
-
$modal = modal.$el.find('#wooccm_modal'),
|
278 |
-
$details = $modal.find('.attachment-details');
|
279 |
-
|
280 |
-
$.ajax({
|
281 |
-
url: wooccm_field.ajax_url,
|
282 |
-
data: {
|
283 |
-
action: 'wooccm_save_field',
|
284 |
-
nonce: wooccm_field.nonce,
|
285 |
-
field_id: modal.model.attributes.id,
|
286 |
-
field_data: $('form', this.$el).serialize()
|
287 |
-
},
|
288 |
-
dataType: 'json',
|
289 |
-
type: 'POST',
|
290 |
-
beforeSend: function () {
|
291 |
-
$('.media-modal-submit').prop('disabled', true);
|
292 |
-
$details.addClass('save-waiting');
|
293 |
-
block();
|
294 |
-
},
|
295 |
-
complete: function () {
|
296 |
-
$details.addClass('save-complete');
|
297 |
-
$details.removeClass('save-waiting');
|
298 |
-
unblock();
|
299 |
-
},
|
300 |
-
error: function () {
|
301 |
-
alert('Error!');
|
302 |
-
},
|
303 |
-
success: function (response) {
|
304 |
-
if (response.success) {
|
305 |
-
|
306 |
-
if (modal.model.attributes.id == undefined) {
|
307 |
-
$modal.addClass('reload');
|
308 |
-
modal.close(e);
|
309 |
-
}
|
310 |
-
|
311 |
-
//re-render dont load select2 saved options
|
312 |
-
modal.model.set(response.data);
|
313 |
-
//$modal.addClass('reload');
|
314 |
-
|
315 |
-
} else {
|
316 |
-
alert(response.data);
|
317 |
-
}
|
318 |
-
}
|
319 |
-
});
|
320 |
-
return false;
|
321 |
-
}
|
322 |
-
});
|
323 |
-
var FieldModel = Backbone.Model.extend({
|
324 |
-
defaults: wooccm_field.args
|
325 |
-
});
|
326 |
-
var FieldModal = Backbone.View.extend({
|
327 |
-
initialize: function (e) {
|
328 |
-
|
329 |
-
var $button = $(e.target),
|
330 |
-
field_id = $button.closest('[data-field_id]').data('field_id');
|
331 |
-
var model = new FieldModel();
|
332 |
-
model.set({
|
333 |
-
id: field_id
|
334 |
-
});
|
335 |
-
new FieldView({
|
336 |
-
model: model
|
337 |
-
}).render();
|
338 |
-
},
|
339 |
-
});
|
340 |
-
$('#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add').on('click', function (e) {
|
341 |
-
e.preventDefault();
|
342 |
-
new FieldModal(e);
|
343 |
-
});
|
344 |
-
$('#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset').on('click', function (e) {
|
345 |
-
e.preventDefault();
|
346 |
-
var $button = $(e.target);
|
347 |
-
var c = confirm(wooccm_field.message.reset);
|
348 |
-
if (!c) {
|
349 |
-
return false;
|
350 |
-
}
|
351 |
-
|
352 |
-
$.ajax({
|
353 |
-
url: wooccm_field.ajax_url,
|
354 |
-
data: {
|
355 |
-
action: 'wooccm_reset_fields',
|
356 |
-
nonce: wooccm_field.nonce
|
357 |
-
},
|
358 |
-
dataType: 'json',
|
359 |
-
type: 'POST',
|
360 |
-
beforeSend: function () {
|
361 |
-
},
|
362 |
-
complete: function () {
|
363 |
-
},
|
364 |
-
error: function () {
|
365 |
-
alert('Error!');
|
366 |
-
},
|
367 |
-
success: function (response) {
|
368 |
-
if (response.success) {
|
369 |
-
|
370 |
-
location.reload();
|
371 |
-
} else {
|
372 |
-
alert(response.data);
|
373 |
-
}
|
374 |
-
}
|
375 |
-
});
|
376 |
-
return false;
|
377 |
-
});
|
378 |
-
$('.wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit').on('click', function (e) {
|
379 |
-
e.preventDefault();
|
380 |
-
new FieldModal(e);
|
381 |
-
});
|
382 |
-
$('.wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete').on('click', function (e) {
|
383 |
-
e.preventDefault();
|
384 |
-
var $button = $(e.target),
|
385 |
-
$field = $button.closest('[data-field_id]'),
|
386 |
-
field_id = $field.data('field_id');
|
387 |
-
var c = confirm(wooccm_field.message.remove);
|
388 |
-
if (!c) {
|
389 |
-
return false;
|
390 |
-
}
|
391 |
-
|
392 |
-
$.ajax({
|
393 |
-
url: wooccm_field.ajax_url,
|
394 |
-
data: {
|
395 |
-
action: 'wooccm_delete_field',
|
396 |
-
nonce: wooccm_field.nonce,
|
397 |
-
field_id: field_id,
|
398 |
-
},
|
399 |
-
dataType: 'json',
|
400 |
-
type: 'POST',
|
401 |
-
beforeSend: function () {
|
402 |
-
},
|
403 |
-
complete: function () {
|
404 |
-
},
|
405 |
-
error: function () {
|
406 |
-
alert('Error!');
|
407 |
-
},
|
408 |
-
success: function (response) {
|
409 |
-
if (response.success) {
|
410 |
-
|
411 |
-
$field.remove();
|
412 |
-
} else {
|
413 |
-
alert(response.data);
|
414 |
-
}
|
415 |
-
}
|
416 |
-
});
|
417 |
-
return false;
|
418 |
-
});
|
419 |
-
$(document).on('click', '.wooccm-field-toggle-attribute', function (e) {
|
420 |
-
e.preventDefault();
|
421 |
-
var $link = $(this),
|
422 |
-
$tr = $link.closest('tr'),
|
423 |
-
$toggle = $link.find('.woocommerce-input-toggle');
|
424 |
-
$.ajax({
|
425 |
-
url: wooccm_field.ajax_url,
|
426 |
-
data: {
|
427 |
-
action: 'wooccm_toggle_field_attribute',
|
428 |
-
nonce: wooccm_field.nonce,
|
429 |
-
field_attr: $(this).data('field_attr'),
|
430 |
-
field_id: $tr.data('field_id')
|
431 |
-
},
|
432 |
-
dataType: 'json',
|
433 |
-
type: 'POST',
|
434 |
-
beforeSend: function (response) {
|
435 |
-
$toggle.addClass('woocommerce-input-toggle--loading');
|
436 |
-
},
|
437 |
-
success: function (response) {
|
438 |
-
|
439 |
-
if (true === response.data) {
|
440 |
-
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
441 |
-
$toggle.addClass('woocommerce-input-toggle--enabled');
|
442 |
-
$toggle.removeClass('woocommerce-input-toggle--loading');
|
443 |
-
} else if (true !== response.data) {
|
444 |
-
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
445 |
-
$toggle.addClass('woocommerce-input-toggle--disabled');
|
446 |
-
$toggle.removeClass('woocommerce-input-toggle--loading');
|
447 |
-
} //else if ('needs_setup' === response.data) {
|
448 |
-
//window.location.href = $link.attr('href');
|
449 |
-
//}
|
450 |
-
}
|
451 |
-
|
452 |
-
});
|
453 |
-
return false;
|
454 |
-
});
|
455 |
-
$(document).on('change', '.wooccm-field-change-attribute', function (e) {
|
456 |
-
e.preventDefault();
|
457 |
-
var $change = $(this),
|
458 |
-
$tr = $change.closest('tr');
|
459 |
-
$.ajax({
|
460 |
-
url: wooccm_field.ajax_url,
|
461 |
-
data: {
|
462 |
-
action: 'wooccm_change_field_attribute',
|
463 |
-
nonce: wooccm_field.nonce,
|
464 |
-
field_attr: $change.data('field_attr'),
|
465 |
-
field_value: $change.val(),
|
466 |
-
field_id: $tr.data('field_id'),
|
467 |
-
},
|
468 |
-
dataType: 'json',
|
469 |
-
type: 'POST',
|
470 |
-
beforeSend: function (response) {
|
471 |
-
$change.prop('disabled', true);
|
472 |
-
},
|
473 |
-
success: function (response) {
|
474 |
-
console.log(response.data);
|
475 |
-
},
|
476 |
-
complete: function (response) {
|
477 |
-
$change.prop('disabled', false);
|
478 |
-
},
|
479 |
-
});
|
480 |
-
return false;
|
481 |
-
});
|
482 |
})(jQuery);
|
1 |
+
(function ($) {
|
2 |
+
|
3 |
+
var count = 0,
|
4 |
+
timer;
|
5 |
+
|
6 |
+
var is_blocked = function ($node) {
|
7 |
+
return $node.is('.processing') || $node.parents('.processing').length;
|
8 |
+
};
|
9 |
+
var block = function () {
|
10 |
+
$('#wooccm_modal').addClass('processing');
|
11 |
+
};
|
12 |
+
var unblock = function () {
|
13 |
+
$('#wooccm_modal').removeClass('processing');
|
14 |
+
};
|
15 |
+
|
16 |
+
_.mixin({
|
17 |
+
sortOptions: function (object) {
|
18 |
+
return _.sortBy(object, function (o) {
|
19 |
+
return o.order;
|
20 |
+
});
|
21 |
+
}
|
22 |
+
});
|
23 |
+
var FieldViewTabs = Backbone.View.extend({
|
24 |
+
templates: {},
|
25 |
+
initialize: function () {
|
26 |
+
this.templates.window = wp.template('wooccm-modal-tabs');
|
27 |
+
},
|
28 |
+
render: function () {
|
29 |
+
this.model.attributes.panel = 'general';
|
30 |
+
this.$el.html(this.templates.window(this.model.attributes));
|
31 |
+
//this.$el.trigger('wooccm-tab-panels');
|
32 |
+
}
|
33 |
+
});
|
34 |
+
var FieldViewPanels = Backbone.View.extend({
|
35 |
+
templates: {},
|
36 |
+
initialize: function () {
|
37 |
+
this.templates.window = wp.template('wooccm-modal-panels');
|
38 |
+
},
|
39 |
+
render: function () {
|
40 |
+
this.$el.html(this.templates.window(this.model.attributes));
|
41 |
+
this.$el.trigger('wooccm-enhanced-options');
|
42 |
+
this.$el.trigger('wooccm-enhanced-select');
|
43 |
+
this.$el.trigger('init_tooltips');
|
44 |
+
}
|
45 |
+
});
|
46 |
+
var FieldViewInfo = Backbone.View.extend({
|
47 |
+
templates: {},
|
48 |
+
initialize: function () {
|
49 |
+
this.templates.window = wp.template('wooccm-modal-info');
|
50 |
+
},
|
51 |
+
render: function () {
|
52 |
+
this.$el.html(this.templates.window(this.model.attributes));
|
53 |
+
this.$el.trigger('wooccm-enhanced-select');
|
54 |
+
this.$el.trigger('init_tooltips');
|
55 |
+
}
|
56 |
+
});
|
57 |
+
var FieldView = Backbone.View.extend({
|
58 |
+
events: {
|
59 |
+
'change input': 'enableSave',
|
60 |
+
'change textarea': 'enableSave',
|
61 |
+
'change select': 'enableSave',
|
62 |
+
'click .media-modal-backdrop': 'close',
|
63 |
+
'click .media-modal-close': 'close',
|
64 |
+
'click .media-modal-prev': 'edit',
|
65 |
+
'click .media-modal-next': 'edit',
|
66 |
+
'click .media-modal-tab': 'tab',
|
67 |
+
'change .media-modal-parent': 'parent',
|
68 |
+
'change .media-modal-render-tabs': 'renderTabs',
|
69 |
+
'change .media-modal-render-panels': 'renderPanels',
|
70 |
+
'change .media-modal-render-info': 'renderInfo',
|
71 |
+
'submit .media-modal-form': 'submit',
|
72 |
+
},
|
73 |
+
templates: {},
|
74 |
+
initialize: function () {
|
75 |
+
_.bindAll(this, 'tab', 'open', 'edit', 'parent', 'load', 'render', 'close', 'submit');
|
76 |
+
this.init();
|
77 |
+
this.open();
|
78 |
+
},
|
79 |
+
init: function () {
|
80 |
+
this.templates.window = wp.template('wooccm-modal-main');
|
81 |
+
},
|
82 |
+
assign: function (view, selector) {
|
83 |
+
view.setElement(this.$(selector)).render();
|
84 |
+
},
|
85 |
+
render: function () {
|
86 |
+
var modal = this;
|
87 |
+
modal.$el.html(modal.templates.window(modal.model.attributes));
|
88 |
+
this.tabs = new FieldViewTabs({model: modal.model});
|
89 |
+
this.panels = new FieldViewPanels({model: modal.model});
|
90 |
+
this.info = new FieldViewInfo({model: modal.model});
|
91 |
+
this.assign(this.tabs, '#wooccm-modal-tabs');
|
92 |
+
this.assign(this.panels, '#wooccm-modal-panels');
|
93 |
+
this.assign(this.info, '#wooccm-modal-info');
|
94 |
+
},
|
95 |
+
load: function () {
|
96 |
+
|
97 |
+
var modal = this;
|
98 |
+
|
99 |
+
block();
|
100 |
+
|
101 |
+
$.ajax({
|
102 |
+
url: wooccm_field.ajax_url,
|
103 |
+
data: {
|
104 |
+
action: 'wooccm_load_field',
|
105 |
+
nonce: wooccm_field.nonce,
|
106 |
+
field_id: this.model.attributes.id
|
107 |
+
},
|
108 |
+
dataType: 'json',
|
109 |
+
type: 'POST',
|
110 |
+
beforeSend: function () {
|
111 |
+
},
|
112 |
+
complete: function () {
|
113 |
+
unblock();
|
114 |
+
},
|
115 |
+
error: function () {
|
116 |
+
alert('Error!');
|
117 |
+
},
|
118 |
+
success: function (response) {
|
119 |
+
if (response.success) {
|
120 |
+
modal.model.set(response.data);
|
121 |
+
modal.render();
|
122 |
+
} else {
|
123 |
+
alert(response.data);
|
124 |
+
}
|
125 |
+
}
|
126 |
+
});
|
127 |
+
},
|
128 |
+
edit: function (e) {
|
129 |
+
e.preventDefault();
|
130 |
+
var modal = this,
|
131 |
+
$button = $(e.target),
|
132 |
+
field_count = parseInt($('.wc_gateways tr[data-field_id]').length),
|
133 |
+
order = parseInt(modal.model.get('order'));
|
134 |
+
count++;
|
135 |
+
if (timer) {
|
136 |
+
clearTimeout(timer);
|
137 |
+
}
|
138 |
+
|
139 |
+
timer = setTimeout(function () {
|
140 |
+
|
141 |
+
if ($button.hasClass('media-modal-next')) {
|
142 |
+
order = Math.min(order + count, field_count);
|
143 |
+
} else {
|
144 |
+
order = Math.max(order - count, 1);
|
145 |
+
}
|
146 |
+
|
147 |
+
modal.model.set({
|
148 |
+
id: parseInt($('.wc_gateways tr[data-field_order=' + order + ']').data('field_id'))
|
149 |
+
});
|
150 |
+
count = 0;
|
151 |
+
modal.load();
|
152 |
+
}, 300);
|
153 |
+
},
|
154 |
+
open: function (e) {
|
155 |
+
$('body').addClass('modal-open').append(this.$el);
|
156 |
+
if (this.model.attributes.id == undefined) {
|
157 |
+
_.delay(function () {
|
158 |
+
unblock();
|
159 |
+
}, 100);
|
160 |
+
return;
|
161 |
+
}
|
162 |
+
this.load();
|
163 |
+
},
|
164 |
+
updateModel: function (e) {
|
165 |
+
e.preventDefault();
|
166 |
+
|
167 |
+
var $field = $(e.target),
|
168 |
+
name = $field.attr('name'),
|
169 |
+
value = $field.val();
|
170 |
+
|
171 |
+
if (e.target.type === 'checkbox') {
|
172 |
+
value = $field.prop('checked') === true ? 1 : 0;
|
173 |
+
}
|
174 |
+
|
175 |
+
this.model.attributes[name] = value;
|
176 |
+
this.model.changed[name] = value;
|
177 |
+
},
|
178 |
+
tab: function (e) {
|
179 |
+
e.preventDefault();
|
180 |
+
|
181 |
+
var modal = this,
|
182 |
+
$modal = modal.$el.find('#wooccm_modal'),
|
183 |
+
$tab = $(e.currentTarget),
|
184 |
+
$tabs = $modal.find('ul.wc-tabs'),
|
185 |
+
panel = $tab.find('a').attr('href').replace('#', '');
|
186 |
+
|
187 |
+
$tabs.find('.active').removeClass('active');
|
188 |
+
$tab.addClass('active');
|
189 |
+
|
190 |
+
this.model.attributes['panel'] = panel;
|
191 |
+
this.model.changed['panel'] = panel;
|
192 |
+
|
193 |
+
this.renderPanels(e);
|
194 |
+
},
|
195 |
+
renderTabs: function (e) {
|
196 |
+
this.renderPanels(e);
|
197 |
+
this.tabs.render();
|
198 |
+
},
|
199 |
+
renderPanels: function (e) {
|
200 |
+
this.updateModel(e);
|
201 |
+
this.panels.render();
|
202 |
+
},
|
203 |
+
renderInfo: function () {
|
204 |
+
this.info.render();
|
205 |
+
},
|
206 |
+
close: function (e) {
|
207 |
+
e.preventDefault();
|
208 |
+
this.undelegateEvents();
|
209 |
+
$(document).off('focusin');
|
210 |
+
$('body').removeClass('modal-open');
|
211 |
+
this.remove();
|
212 |
+
},
|
213 |
+
parent: function (e) {
|
214 |
+
e.preventDefault();
|
215 |
+
var modal = this,
|
216 |
+
$modal = modal.$el.find('#wooccm_modal'),
|
217 |
+
$details = $modal.find('.attachment-details');
|
218 |
+
this.updateModel(e);
|
219 |
+
$.ajax({
|
220 |
+
url: wooccm_field.ajax_url,
|
221 |
+
data: {
|
222 |
+
action: 'wooccm_load_parent',
|
223 |
+
nonce: wooccm_field.nonce,
|
224 |
+
conditional_parent_key: modal.model.attributes.conditional_parent_key
|
225 |
+
},
|
226 |
+
dataType: 'json',
|
227 |
+
type: 'POST',
|
228 |
+
beforeSend: function () {
|
229 |
+
modal.disableSave();
|
230 |
+
$details.addClass('save-waiting');
|
231 |
+
},
|
232 |
+
complete: function () {
|
233 |
+
$details.addClass('save-complete');
|
234 |
+
$details.removeClass('save-waiting');
|
235 |
+
modal.enableSave();
|
236 |
+
},
|
237 |
+
error: function () {
|
238 |
+
alert('Error!');
|
239 |
+
},
|
240 |
+
success: function (response) {
|
241 |
+
if (response.success) {
|
242 |
+
modal.model.attributes['parent'] = response.data;
|
243 |
+
modal.model.changed['parent'] = response.data;
|
244 |
+
modal.renderInfo();
|
245 |
+
} else {
|
246 |
+
alert(response.data);
|
247 |
+
}
|
248 |
+
}
|
249 |
+
});
|
250 |
+
return false;
|
251 |
+
},
|
252 |
+
reload: function (e) {
|
253 |
+
if (this.$el.find('#wooccm_modal').hasClass('reload')) {
|
254 |
+
location.reload();
|
255 |
+
return;
|
256 |
+
}
|
257 |
+
this.remove();
|
258 |
+
return;
|
259 |
+
},
|
260 |
+
close: function (e) {
|
261 |
+
e.preventDefault();
|
262 |
+
this.undelegateEvents();
|
263 |
+
$(document).off('focusin');
|
264 |
+
$('body').removeClass('modal-open');
|
265 |
+
this.reload(e);
|
266 |
+
return;
|
267 |
+
},
|
268 |
+
enableSave: function (e) {
|
269 |
+
$('.media-modal-submit').removeProp('disabled');
|
270 |
+
},
|
271 |
+
disableSave: function (e) {
|
272 |
+
$('.media-modal-submit').prop('disabled', true);
|
273 |
+
},
|
274 |
+
submit: function (e) {
|
275 |
+
e.preventDefault();
|
276 |
+
var modal = this,
|
277 |
+
$modal = modal.$el.find('#wooccm_modal'),
|
278 |
+
$details = $modal.find('.attachment-details');
|
279 |
+
|
280 |
+
$.ajax({
|
281 |
+
url: wooccm_field.ajax_url,
|
282 |
+
data: {
|
283 |
+
action: 'wooccm_save_field',
|
284 |
+
nonce: wooccm_field.nonce,
|
285 |
+
field_id: modal.model.attributes.id,
|
286 |
+
field_data: $('form', this.$el).serialize()
|
287 |
+
},
|
288 |
+
dataType: 'json',
|
289 |
+
type: 'POST',
|
290 |
+
beforeSend: function () {
|
291 |
+
$('.media-modal-submit').prop('disabled', true);
|
292 |
+
$details.addClass('save-waiting');
|
293 |
+
block();
|
294 |
+
},
|
295 |
+
complete: function () {
|
296 |
+
$details.addClass('save-complete');
|
297 |
+
$details.removeClass('save-waiting');
|
298 |
+
unblock();
|
299 |
+
},
|
300 |
+
error: function () {
|
301 |
+
alert('Error!');
|
302 |
+
},
|
303 |
+
success: function (response) {
|
304 |
+
if (response.success) {
|
305 |
+
|
306 |
+
if (modal.model.attributes.id == undefined) {
|
307 |
+
$modal.addClass('reload');
|
308 |
+
modal.close(e);
|
309 |
+
}
|
310 |
+
|
311 |
+
//re-render dont load select2 saved options
|
312 |
+
modal.model.set(response.data);
|
313 |
+
//$modal.addClass('reload');
|
314 |
+
|
315 |
+
} else {
|
316 |
+
alert(response.data);
|
317 |
+
}
|
318 |
+
}
|
319 |
+
});
|
320 |
+
return false;
|
321 |
+
}
|
322 |
+
});
|
323 |
+
var FieldModel = Backbone.Model.extend({
|
324 |
+
defaults: wooccm_field.args
|
325 |
+
});
|
326 |
+
var FieldModal = Backbone.View.extend({
|
327 |
+
initialize: function (e) {
|
328 |
+
|
329 |
+
var $button = $(e.target),
|
330 |
+
field_id = $button.closest('[data-field_id]').data('field_id');
|
331 |
+
var model = new FieldModel();
|
332 |
+
model.set({
|
333 |
+
id: field_id
|
334 |
+
});
|
335 |
+
new FieldView({
|
336 |
+
model: model
|
337 |
+
}).render();
|
338 |
+
},
|
339 |
+
});
|
340 |
+
$('#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add').on('click', function (e) {
|
341 |
+
e.preventDefault();
|
342 |
+
new FieldModal(e);
|
343 |
+
});
|
344 |
+
$('#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset').on('click', function (e) {
|
345 |
+
e.preventDefault();
|
346 |
+
var $button = $(e.target);
|
347 |
+
var c = confirm(wooccm_field.message.reset);
|
348 |
+
if (!c) {
|
349 |
+
return false;
|
350 |
+
}
|
351 |
+
|
352 |
+
$.ajax({
|
353 |
+
url: wooccm_field.ajax_url,
|
354 |
+
data: {
|
355 |
+
action: 'wooccm_reset_fields',
|
356 |
+
nonce: wooccm_field.nonce
|
357 |
+
},
|
358 |
+
dataType: 'json',
|
359 |
+
type: 'POST',
|
360 |
+
beforeSend: function () {
|
361 |
+
},
|
362 |
+
complete: function () {
|
363 |
+
},
|
364 |
+
error: function () {
|
365 |
+
alert('Error!');
|
366 |
+
},
|
367 |
+
success: function (response) {
|
368 |
+
if (response.success) {
|
369 |
+
|
370 |
+
location.reload();
|
371 |
+
} else {
|
372 |
+
alert(response.data);
|
373 |
+
}
|
374 |
+
}
|
375 |
+
});
|
376 |
+
return false;
|
377 |
+
});
|
378 |
+
$('.wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit').on('click', function (e) {
|
379 |
+
e.preventDefault();
|
380 |
+
new FieldModal(e);
|
381 |
+
});
|
382 |
+
$('.wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete').on('click', function (e) {
|
383 |
+
e.preventDefault();
|
384 |
+
var $button = $(e.target),
|
385 |
+
$field = $button.closest('[data-field_id]'),
|
386 |
+
field_id = $field.data('field_id');
|
387 |
+
var c = confirm(wooccm_field.message.remove);
|
388 |
+
if (!c) {
|
389 |
+
return false;
|
390 |
+
}
|
391 |
+
|
392 |
+
$.ajax({
|
393 |
+
url: wooccm_field.ajax_url,
|
394 |
+
data: {
|
395 |
+
action: 'wooccm_delete_field',
|
396 |
+
nonce: wooccm_field.nonce,
|
397 |
+
field_id: field_id,
|
398 |
+
},
|
399 |
+
dataType: 'json',
|
400 |
+
type: 'POST',
|
401 |
+
beforeSend: function () {
|
402 |
+
},
|
403 |
+
complete: function () {
|
404 |
+
},
|
405 |
+
error: function () {
|
406 |
+
alert('Error!');
|
407 |
+
},
|
408 |
+
success: function (response) {
|
409 |
+
if (response.success) {
|
410 |
+
|
411 |
+
$field.remove();
|
412 |
+
} else {
|
413 |
+
alert(response.data);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
});
|
417 |
+
return false;
|
418 |
+
});
|
419 |
+
$(document).on('click', '.wooccm-field-toggle-attribute', function (e) {
|
420 |
+
e.preventDefault();
|
421 |
+
var $link = $(this),
|
422 |
+
$tr = $link.closest('tr'),
|
423 |
+
$toggle = $link.find('.woocommerce-input-toggle');
|
424 |
+
$.ajax({
|
425 |
+
url: wooccm_field.ajax_url,
|
426 |
+
data: {
|
427 |
+
action: 'wooccm_toggle_field_attribute',
|
428 |
+
nonce: wooccm_field.nonce,
|
429 |
+
field_attr: $(this).data('field_attr'),
|
430 |
+
field_id: $tr.data('field_id')
|
431 |
+
},
|
432 |
+
dataType: 'json',
|
433 |
+
type: 'POST',
|
434 |
+
beforeSend: function (response) {
|
435 |
+
$toggle.addClass('woocommerce-input-toggle--loading');
|
436 |
+
},
|
437 |
+
success: function (response) {
|
438 |
+
|
439 |
+
if (true === response.data) {
|
440 |
+
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
441 |
+
$toggle.addClass('woocommerce-input-toggle--enabled');
|
442 |
+
$toggle.removeClass('woocommerce-input-toggle--loading');
|
443 |
+
} else if (true !== response.data) {
|
444 |
+
$toggle.removeClass('woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled');
|
445 |
+
$toggle.addClass('woocommerce-input-toggle--disabled');
|
446 |
+
$toggle.removeClass('woocommerce-input-toggle--loading');
|
447 |
+
} //else if ('needs_setup' === response.data) {
|
448 |
+
//window.location.href = $link.attr('href');
|
449 |
+
//}
|
450 |
+
}
|
451 |
+
|
452 |
+
});
|
453 |
+
return false;
|
454 |
+
});
|
455 |
+
$(document).on('change', '.wooccm-field-change-attribute', function (e) {
|
456 |
+
e.preventDefault();
|
457 |
+
var $change = $(this),
|
458 |
+
$tr = $change.closest('tr');
|
459 |
+
$.ajax({
|
460 |
+
url: wooccm_field.ajax_url,
|
461 |
+
data: {
|
462 |
+
action: 'wooccm_change_field_attribute',
|
463 |
+
nonce: wooccm_field.nonce,
|
464 |
+
field_attr: $change.data('field_attr'),
|
465 |
+
field_value: $change.val(),
|
466 |
+
field_id: $tr.data('field_id'),
|
467 |
+
},
|
468 |
+
dataType: 'json',
|
469 |
+
type: 'POST',
|
470 |
+
beforeSend: function (response) {
|
471 |
+
$change.prop('disabled', true);
|
472 |
+
},
|
473 |
+
success: function (response) {
|
474 |
+
console.log(response.data);
|
475 |
+
},
|
476 |
+
complete: function (response) {
|
477 |
+
$change.prop('disabled', false);
|
478 |
+
},
|
479 |
+
});
|
480 |
+
return false;
|
481 |
+
});
|
482 |
})(jQuery);
|
assets/backend/js/wooccm-admin.js
CHANGED
@@ -1,279 +1,279 @@
|
|
1 |
-
(function ($) {
|
2 |
-
|
3 |
-
$('.wooccm-premium-field').closest('tr').addClass('wooccm-premium');
|
4 |
-
|
5 |
-
function date_picker_select(datepicker) {
|
6 |
-
var option = $(datepicker).next().is('.hasDatepicker') ? 'minDate' : 'maxDate',
|
7 |
-
otherDateField = 'minDate' === option ? $(datepicker).next() : $(datepicker).prev(),
|
8 |
-
date = $(datepicker).datepicker('getDate');
|
9 |
-
|
10 |
-
$(otherDateField).datepicker('option', option, date);
|
11 |
-
$(datepicker).change();
|
12 |
-
}
|
13 |
-
|
14 |
-
function getEnhancedSelectFormatString() {
|
15 |
-
return {
|
16 |
-
'language': {
|
17 |
-
errorLoading: function () {
|
18 |
-
// Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.
|
19 |
-
return wc_enhanced_select_params.i18n_searching;
|
20 |
-
},
|
21 |
-
inputTooLong: function (args) {
|
22 |
-
var overChars = args.input.length - args.maximum;
|
23 |
-
|
24 |
-
if (1 === overChars) {
|
25 |
-
return wc_enhanced_select_params.i18n_input_too_long_1;
|
26 |
-
}
|
27 |
-
|
28 |
-
return wc_enhanced_select_params.i18n_input_too_long_n.replace('%qty%', overChars);
|
29 |
-
},
|
30 |
-
inputTooShort: function (args) {
|
31 |
-
var remainingChars = args.minimum - args.input.length;
|
32 |
-
|
33 |
-
if (1 === remainingChars) {
|
34 |
-
return wc_enhanced_select_params.i18n_input_too_short_1;
|
35 |
-
}
|
36 |
-
|
37 |
-
return wc_enhanced_select_params.i18n_input_too_short_n.replace('%qty%', remainingChars);
|
38 |
-
},
|
39 |
-
loadingMore: function () {
|
40 |
-
return wc_enhanced_select_params.i18n_load_more;
|
41 |
-
},
|
42 |
-
maximumSelected: function (args) {
|
43 |
-
if (args.maximum === 1) {
|
44 |
-
return wc_enhanced_select_params.i18n_selection_too_long_1;
|
45 |
-
}
|
46 |
-
|
47 |
-
return wc_enhanced_select_params.i18n_selection_too_long_n.replace('%qty%', args.maximum);
|
48 |
-
},
|
49 |
-
noResults: function () {
|
50 |
-
return wc_enhanced_select_params.i18n_no_matches;
|
51 |
-
},
|
52 |
-
searching: function () {
|
53 |
-
return wc_enhanced_select_params.i18n_searching;
|
54 |
-
}
|
55 |
-
}
|
56 |
-
};
|
57 |
-
}
|
58 |
-
|
59 |
-
$(document).on('wooccm-enhanced-between-dates', function (e) {
|
60 |
-
|
61 |
-
$('.wooccm-enhanced-between-dates').filter(':not(.enhanced)').each(function () {
|
62 |
-
|
63 |
-
$(this).find('input').datepicker({
|
64 |
-
defaultDate: '',
|
65 |
-
dateFormat: 'yy-mm-dd',
|
66 |
-
numberOfMonths: 1,
|
67 |
-
showButtonPanel: true,
|
68 |
-
onSelect: function () {
|
69 |
-
date_picker_select($(this));
|
70 |
-
}
|
71 |
-
});
|
72 |
-
|
73 |
-
$(this).find('input').each(function () {
|
74 |
-
date_picker_select($(this));
|
75 |
-
});
|
76 |
-
|
77 |
-
});
|
78 |
-
|
79 |
-
});
|
80 |
-
|
81 |
-
$(document).on('wooccm-enhanced-options', function (e) {
|
82 |
-
|
83 |
-
$('table.wc_gateways tbody').sortable({
|
84 |
-
items: 'tr',
|
85 |
-
cursor: 'move',
|
86 |
-
axis: 'y',
|
87 |
-
handle: 'td.sort',
|
88 |
-
scrollSensitivity: 40,
|
89 |
-
helper: function (event, ui) {
|
90 |
-
ui.children().each(function () {
|
91 |
-
$(this).width($(this).width());
|
92 |
-
});
|
93 |
-
ui.css('left', '0');
|
94 |
-
return ui;
|
95 |
-
},
|
96 |
-
start: function (event, ui) {
|
97 |
-
ui.item.css('background-color', '#f6f6f6');
|
98 |
-
},
|
99 |
-
stop: function (event, ui) {
|
100 |
-
ui.item.removeAttr('style');
|
101 |
-
ui.item.trigger('updateMoveButtons');
|
102 |
-
},
|
103 |
-
update: function (event, ui) {
|
104 |
-
$(this).find('tr').each(function (i, tr) {
|
105 |
-
$(tr).find('input.add-order').val(i).trigger('change');
|
106 |
-
});
|
107 |
-
}
|
108 |
-
});
|
109 |
-
|
110 |
-
$('.wooccm-enhanced-options').each(function () {
|
111 |
-
|
112 |
-
var $table = $(this),
|
113 |
-
$add = $table.find('.add-option'),
|
114 |
-
$remove = $table.find('.remove-options');
|
115 |
-
|
116 |
-
$add.on('click', function (e) {
|
117 |
-
|
118 |
-
var $tr = $table.find('tbody > tr'),
|
119 |
-
id = $tr.length,
|
120 |
-
tr = $tr.first().clone().html().replace(/options\[([0-9]+)\]/g, 'options[' + id + ']').replace('disabled="disabled"', '').replace('checked="checked"', '').replace('<input value="0"', '<input value="' + id + '"').replace('<input value="0"', '<input value="' + id + '"');
|
121 |
-
|
122 |
-
$tr.last().after($('<tr>' + tr + '</tr>')).find('input').trigger('change');
|
123 |
-
|
124 |
-
$remove.removeProp('disabled');
|
125 |
-
|
126 |
-
});
|
127 |
-
|
128 |
-
$remove.on('click', function (e) {
|
129 |
-
|
130 |
-
$table.find('tr > td.check-column input:checked').closest('tr').remove();
|
131 |
-
|
132 |
-
var $tr = $table.find('tbody > tr');
|
133 |
-
|
134 |
-
if ($tr.length < 2) {
|
135 |
-
$(this).prop('disabled', true);
|
136 |
-
}
|
137 |
-
});
|
138 |
-
|
139 |
-
});
|
140 |
-
|
141 |
-
});
|
142 |
-
|
143 |
-
$(document).on('wooccm-enhanced-select', function (e) {
|
144 |
-
|
145 |
-
$('.wooccm-enhanced-select').filter(':not(.enhanced)').each(function () {
|
146 |
-
var select2_args = $.extend({
|
147 |
-
minimumResultsForSearch: 10,
|
148 |
-
allowClear: $(this).data('allow_clear') ? true : false,
|
149 |
-
placeholder: $(this).data('placeholder')
|
150 |
-
}, getEnhancedSelectFormatString());
|
151 |
-
|
152 |
-
$(this).selectWoo(select2_args).addClass('enhanced');
|
153 |
-
});
|
154 |
-
|
155 |
-
$('.wooccm-product-search').filter(':not(.enhanced)').each(function () {
|
156 |
-
|
157 |
-
var select2_args = {
|
158 |
-
allowClear: $(this).data('allow_clear') ? true : false,
|
159 |
-
placeholder: $(this).data('placeholder'),
|
160 |
-
minimumInputLength: $(this).data('minimum_input_length') ? $(this).data('minimum_input_length') : '3',
|
161 |
-
escapeMarkup: function (m) {
|
162 |
-
return m;
|
163 |
-
},
|
164 |
-
ajax: {
|
165 |
-
url: wc_enhanced_select_params.ajax_url,
|
166 |
-
dataType: 'json',
|
167 |
-
delay: 250,
|
168 |
-
data: function (params) {
|
169 |
-
return {
|
170 |
-
term: params.term,
|
171 |
-
action: $(this).data('action') || 'wooccm_select_search_products',
|
172 |
-
//nonce: wooccm_admin.nonce,
|
173 |
-
security: wc_enhanced_select_params.search_products_nonce,
|
174 |
-
selected: $(this).select2('val') || 0,
|
175 |
-
exclude: $(this).data('exclude'),
|
176 |
-
include: $(this).data('include'),
|
177 |
-
limit: $(this).data('limit'),
|
178 |
-
display_stock: $(this).data('display_stock')
|
179 |
-
};
|
180 |
-
},
|
181 |
-
processResults: function (data) {
|
182 |
-
var terms = [];
|
183 |
-
if (data) {
|
184 |
-
$.each(data, function (id, text) {
|
185 |
-
terms.push({id: id, text: text});
|
186 |
-
});
|
187 |
-
}
|
188 |
-
return {
|
189 |
-
results: terms
|
190 |
-
};
|
191 |
-
},
|
192 |
-
cache: true
|
193 |
-
}
|
194 |
-
};
|
195 |
-
|
196 |
-
select2_args = $.extend(select2_args, getEnhancedSelectFormatString());
|
197 |
-
|
198 |
-
$(this).selectWoo(select2_args).addClass('enhanced');
|
199 |
-
|
200 |
-
if ($(this).data('sortable')) {
|
201 |
-
var $select = $(this);
|
202 |
-
var $list = $(this).next('.select2-container').find('ul.select2-selection__rendered');
|
203 |
-
|
204 |
-
$list.sortable({
|
205 |
-
placeholder: 'ui-state-highlight select2-selection__choice',
|
206 |
-
forcePlaceholderSize: true,
|
207 |
-
items: 'li:not(.select2-search__field)',
|
208 |
-
tolerance: 'pointer',
|
209 |
-
stop: function () {
|
210 |
-
$($list.find('.select2-selection__choice').get().reverse()).each(function () {
|
211 |
-
var id = $(this).data('data').id;
|
212 |
-
var option = $select.find('option[value="' + id + '"]')[0];
|
213 |
-
$select.prepend(option);
|
214 |
-
});
|
215 |
-
}
|
216 |
-
});
|
217 |
-
// Keep multiselects ordered alphabetically if they are not sortable.
|
218 |
-
} else if ($(this).prop('multiple')) {
|
219 |
-
$(this).on('change', function () {
|
220 |
-
var $children = $(this).children();
|
221 |
-
$children.sort(function (a, b) {
|
222 |
-
var atext = a.text.toLowerCase();
|
223 |
-
var btext = b.text.toLowerCase();
|
224 |
-
|
225 |
-
if (atext > btext) {
|
226 |
-
return 1;
|
227 |
-
}
|
228 |
-
if (atext < btext) {
|
229 |
-
return -1;
|
230 |
-
}
|
231 |
-
return 0;
|
232 |
-
});
|
233 |
-
$(this).html($children);
|
234 |
-
});
|
235 |
-
}
|
236 |
-
});
|
237 |
-
|
238 |
-
});
|
239 |
-
|
240 |
-
$('.wooccm-enhanced-search').filter(':not(.enhanced)').each(function () {
|
241 |
-
|
242 |
-
var select2_args = {
|
243 |
-
allowClear: $(this).data('allow_clear') ? true : false,
|
244 |
-
placeholder: $(this).data('placeholder'),
|
245 |
-
minimumInputLength: $(this).data('minimum_input_length') || '3',
|
246 |
-
escapeMarkup: function (m) {
|
247 |
-
return m;
|
248 |
-
},
|
249 |
-
ajax: {
|
250 |
-
url: wooccm_admin.ajax_url,
|
251 |
-
dataType: 'json',
|
252 |
-
cache: true,
|
253 |
-
delay: 250,
|
254 |
-
data: function (params) {
|
255 |
-
return {
|
256 |
-
term: params.term,
|
257 |
-
key: $(this).data('key'),
|
258 |
-
action: 'wooccm_search_field',
|
259 |
-
nonce: wooccm_admin.nonce,
|
260 |
-
};
|
261 |
-
},
|
262 |
-
processResults: function (data, params) {
|
263 |
-
var terms = [];
|
264 |
-
if (data) {
|
265 |
-
$.each(data, function (id, text) {
|
266 |
-
terms.push({id: id, text: text});
|
267 |
-
});
|
268 |
-
}
|
269 |
-
return {results: terms};
|
270 |
-
}
|
271 |
-
}
|
272 |
-
};
|
273 |
-
|
274 |
-
select2_args = $.extend(select2_args, getEnhancedSelectFormatString());
|
275 |
-
|
276 |
-
$(this).select2(select2_args).addClass('enhanced');
|
277 |
-
});
|
278 |
-
|
279 |
})(jQuery);
|
1 |
+
(function ($) {
|
2 |
+
|
3 |
+
$('.wooccm-premium-field').closest('tr').addClass('wooccm-premium');
|
4 |
+
|
5 |
+
function date_picker_select(datepicker) {
|
6 |
+
var option = $(datepicker).next().is('.hasDatepicker') ? 'minDate' : 'maxDate',
|
7 |
+
otherDateField = 'minDate' === option ? $(datepicker).next() : $(datepicker).prev(),
|
8 |
+
date = $(datepicker).datepicker('getDate');
|
9 |
+
|
10 |
+
$(otherDateField).datepicker('option', option, date);
|
11 |
+
$(datepicker).change();
|
12 |
+
}
|
13 |
+
|
14 |
+
function getEnhancedSelectFormatString() {
|
15 |
+
return {
|
16 |
+
'language': {
|
17 |
+
errorLoading: function () {
|
18 |
+
// Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.
|
19 |
+
return wc_enhanced_select_params.i18n_searching;
|
20 |
+
},
|
21 |
+
inputTooLong: function (args) {
|
22 |
+
var overChars = args.input.length - args.maximum;
|
23 |
+
|
24 |
+
if (1 === overChars) {
|
25 |
+
return wc_enhanced_select_params.i18n_input_too_long_1;
|
26 |
+
}
|
27 |
+
|
28 |
+
return wc_enhanced_select_params.i18n_input_too_long_n.replace('%qty%', overChars);
|
29 |
+
},
|
30 |
+
inputTooShort: function (args) {
|
31 |
+
var remainingChars = args.minimum - args.input.length;
|
32 |
+
|
33 |
+
if (1 === remainingChars) {
|
34 |
+
return wc_enhanced_select_params.i18n_input_too_short_1;
|
35 |
+
}
|
36 |
+
|
37 |
+
return wc_enhanced_select_params.i18n_input_too_short_n.replace('%qty%', remainingChars);
|
38 |
+
},
|
39 |
+
loadingMore: function () {
|
40 |
+
return wc_enhanced_select_params.i18n_load_more;
|
41 |
+
},
|
42 |
+
maximumSelected: function (args) {
|
43 |
+
if (args.maximum === 1) {
|
44 |
+
return wc_enhanced_select_params.i18n_selection_too_long_1;
|
45 |
+
}
|
46 |
+
|
47 |
+
return wc_enhanced_select_params.i18n_selection_too_long_n.replace('%qty%', args.maximum);
|
48 |
+
},
|
49 |
+
noResults: function () {
|
50 |
+
return wc_enhanced_select_params.i18n_no_matches;
|
51 |
+
},
|
52 |
+
searching: function () {
|
53 |
+
return wc_enhanced_select_params.i18n_searching;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
};
|
57 |
+
}
|
58 |
+
|
59 |
+
$(document).on('wooccm-enhanced-between-dates', function (e) {
|
60 |
+
|
61 |
+
$('.wooccm-enhanced-between-dates').filter(':not(.enhanced)').each(function () {
|
62 |
+
|
63 |
+
$(this).find('input').datepicker({
|
64 |
+
defaultDate: '',
|
65 |
+
dateFormat: 'yy-mm-dd',
|
66 |
+
numberOfMonths: 1,
|
67 |
+
showButtonPanel: true,
|
68 |
+
onSelect: function () {
|
69 |
+
date_picker_select($(this));
|
70 |
+
}
|
71 |
+
});
|
72 |
+
|
73 |
+
$(this).find('input').each(function () {
|
74 |
+
date_picker_select($(this));
|
75 |
+
});
|
76 |
+
|
77 |
+
});
|
78 |
+
|
79 |
+
});
|
80 |
+
|
81 |
+
$(document).on('wooccm-enhanced-options', function (e) {
|
82 |
+
|
83 |
+
$('table.wc_gateways tbody').sortable({
|
84 |
+
items: 'tr',
|
85 |
+
cursor: 'move',
|
86 |
+
axis: 'y',
|
87 |
+
handle: 'td.sort',
|
88 |
+
scrollSensitivity: 40,
|
89 |
+
helper: function (event, ui) {
|
90 |
+
ui.children().each(function () {
|
91 |
+
$(this).width($(this).width());
|
92 |
+
});
|
93 |
+
ui.css('left', '0');
|
94 |
+
return ui;
|
95 |
+
},
|
96 |
+
start: function (event, ui) {
|
97 |
+
ui.item.css('background-color', '#f6f6f6');
|
98 |
+
},
|
99 |
+
stop: function (event, ui) {
|
100 |
+
ui.item.removeAttr('style');
|
101 |
+
ui.item.trigger('updateMoveButtons');
|
102 |
+
},
|
103 |
+
update: function (event, ui) {
|
104 |
+
$(this).find('tr').each(function (i, tr) {
|
105 |
+
$(tr).find('input.add-order').val(i).trigger('change');
|
106 |
+
});
|
107 |
+
}
|
108 |
+
});
|
109 |
+
|
110 |
+
$('.wooccm-enhanced-options').each(function () {
|
111 |
+
|
112 |
+
var $table = $(this),
|
113 |
+
$add = $table.find('.add-option'),
|
114 |
+
$remove = $table.find('.remove-options');
|
115 |
+
|
116 |
+
$add.on('click', function (e) {
|
117 |
+
|
118 |
+
var $tr = $table.find('tbody > tr'),
|
119 |
+
id = $tr.length,
|
120 |
+
tr = $tr.first().clone().html().replace(/options\[([0-9]+)\]/g, 'options[' + id + ']').replace('disabled="disabled"', '').replace('checked="checked"', '').replace('<input value="0"', '<input value="' + id + '"').replace('<input value="0"', '<input value="' + id + '"');
|
121 |
+
|
122 |
+
$tr.last().after($('<tr>' + tr + '</tr>')).find('input').trigger('change');
|
123 |
+
|
124 |
+
$remove.removeProp('disabled');
|
125 |
+
|
126 |
+
});
|
127 |
+
|
128 |
+
$remove.on('click', function (e) {
|
129 |
+
|
130 |
+
$table.find('tr > td.check-column input:checked').closest('tr').remove();
|
131 |
+
|
132 |
+
var $tr = $table.find('tbody > tr');
|
133 |
+
|
134 |
+
if ($tr.length < 2) {
|
135 |
+
$(this).prop('disabled', true);
|
136 |
+
}
|
137 |
+
});
|
138 |
+
|
139 |
+
});
|
140 |
+
|
141 |
+
});
|
142 |
+
|
143 |
+
$(document).on('wooccm-enhanced-select', function (e) {
|
144 |
+
|
145 |
+
$('.wooccm-enhanced-select').filter(':not(.enhanced)').each(function () {
|
146 |
+
var select2_args = $.extend({
|
147 |
+
minimumResultsForSearch: 10,
|
148 |
+
allowClear: $(this).data('allow_clear') ? true : false,
|
149 |
+
placeholder: $(this).data('placeholder')
|
150 |
+
}, getEnhancedSelectFormatString());
|
151 |
+
|
152 |
+
$(this).selectWoo(select2_args).addClass('enhanced');
|
153 |
+
});
|
154 |
+
|
155 |
+
$('.wooccm-product-search').filter(':not(.enhanced)').each(function () {
|
156 |
+
|
157 |
+
var select2_args = {
|
158 |
+
allowClear: $(this).data('allow_clear') ? true : false,
|
159 |
+
placeholder: $(this).data('placeholder'),
|
160 |
+
minimumInputLength: $(this).data('minimum_input_length') ? $(this).data('minimum_input_length') : '3',
|
161 |
+
escapeMarkup: function (m) {
|
162 |
+
return m;
|
163 |
+
},
|
164 |
+
ajax: {
|
165 |
+
url: wc_enhanced_select_params.ajax_url,
|
166 |
+
dataType: 'json',
|
167 |
+
delay: 250,
|
168 |
+
data: function (params) {
|
169 |
+
return {
|
170 |
+
term: params.term,
|
171 |
+
action: $(this).data('action') || 'wooccm_select_search_products',
|
172 |
+
//nonce: wooccm_admin.nonce,
|
173 |
+
security: wc_enhanced_select_params.search_products_nonce,
|
174 |
+
selected: $(this).select2('val') || 0,
|
175 |
+
exclude: $(this).data('exclude'),
|
176 |
+
include: $(this).data('include'),
|
177 |
+
limit: $(this).data('limit'),
|
178 |
+
display_stock: $(this).data('display_stock')
|
179 |
+
};
|
180 |
+
},
|
181 |
+
processResults: function (data) {
|
182 |
+
var terms = [];
|
183 |
+
if (data) {
|
184 |
+
$.each(data, function (id, text) {
|
185 |
+
terms.push({id: id, text: text});
|
186 |
+
});
|
187 |
+
}
|
188 |
+
return {
|
189 |
+
results: terms
|
190 |
+
};
|
191 |
+
},
|
192 |
+
cache: true
|
193 |
+
}
|
194 |
+
};
|
195 |
+
|
196 |
+
select2_args = $.extend(select2_args, getEnhancedSelectFormatString());
|
197 |
+
|
198 |
+
$(this).selectWoo(select2_args).addClass('enhanced');
|
199 |
+
|
200 |
+
if ($(this).data('sortable')) {
|
201 |
+
var $select = $(this);
|
202 |
+
var $list = $(this).next('.select2-container').find('ul.select2-selection__rendered');
|
203 |
+
|
204 |
+
$list.sortable({
|
205 |
+
placeholder: 'ui-state-highlight select2-selection__choice',
|
206 |
+
forcePlaceholderSize: true,
|
207 |
+
items: 'li:not(.select2-search__field)',
|
208 |
+
tolerance: 'pointer',
|
209 |
+
stop: function () {
|
210 |
+
$($list.find('.select2-selection__choice').get().reverse()).each(function () {
|
211 |
+
var id = $(this).data('data').id;
|
212 |
+
var option = $select.find('option[value="' + id + '"]')[0];
|
213 |
+
$select.prepend(option);
|
214 |
+
});
|
215 |
+
}
|
216 |
+
});
|
217 |
+
// Keep multiselects ordered alphabetically if they are not sortable.
|
218 |
+
} else if ($(this).prop('multiple')) {
|
219 |
+
$(this).on('change', function () {
|
220 |
+
var $children = $(this).children();
|
221 |
+
$children.sort(function (a, b) {
|
222 |
+
var atext = a.text.toLowerCase();
|
223 |
+
var btext = b.text.toLowerCase();
|
224 |
+
|
225 |
+
if (atext > btext) {
|
226 |
+
return 1;
|
227 |
+
}
|
228 |
+
if (atext < btext) {
|
229 |
+
return -1;
|
230 |
+
}
|
231 |
+
return 0;
|
232 |
+
});
|
233 |
+
$(this).html($children);
|
234 |
+
});
|
235 |
+
}
|
236 |
+
});
|
237 |
+
|
238 |
+
});
|
239 |
+
|
240 |
+
$('.wooccm-enhanced-search').filter(':not(.enhanced)').each(function () {
|
241 |
+
|
242 |
+
var select2_args = {
|
243 |
+
allowClear: $(this).data('allow_clear') ? true : false,
|
244 |
+
placeholder: $(this).data('placeholder'),
|
245 |
+
minimumInputLength: $(this).data('minimum_input_length') || '3',
|
246 |
+
escapeMarkup: function (m) {
|
247 |
+
return m;
|
248 |
+
},
|
249 |
+
ajax: {
|
250 |
+
url: wooccm_admin.ajax_url,
|
251 |
+
dataType: 'json',
|
252 |
+
cache: true,
|
253 |
+
delay: 250,
|
254 |
+
data: function (params) {
|
255 |
+
return {
|
256 |
+
term: params.term,
|
257 |
+
key: $(this).data('key'),
|
258 |
+
action: 'wooccm_search_field',
|
259 |
+
nonce: wooccm_admin.nonce,
|
260 |
+
};
|
261 |
+
},
|
262 |
+
processResults: function (data, params) {
|
263 |
+
var terms = [];
|
264 |
+
if (data) {
|
265 |
+
$.each(data, function (id, text) {
|
266 |
+
terms.push({id: id, text: text});
|
267 |
+
});
|
268 |
+
}
|
269 |
+
return {results: terms};
|
270 |
+
}
|
271 |
+
}
|
272 |
+
};
|
273 |
+
|
274 |
+
select2_args = $.extend(select2_args, getEnhancedSelectFormatString());
|
275 |
+
|
276 |
+
$(this).select2(select2_args).addClass('enhanced');
|
277 |
+
});
|
278 |
+
|
279 |
})(jQuery);
|
assets/frontend/css/wooccm.css
CHANGED
@@ -1,121 +1,121 @@
|
|
1 |
-
.woocommerce form {
|
2 |
-
/* @media (min-width: 768px) {
|
3 |
-
.wooccm-field {
|
4 |
-
&.form-row-first {
|
5 |
-
width: 47.0588235294%;
|
6 |
-
float: left;
|
7 |
-
margin-right: 5.8823529412%;
|
8 |
-
clear: both;
|
9 |
-
}
|
10 |
-
&.form-row-last {
|
11 |
-
width: 45.4545454545%;
|
12 |
-
float: right;
|
13 |
-
margin-right: 0;
|
14 |
-
}
|
15 |
-
}
|
16 |
-
}*/
|
17 |
-
}
|
18 |
-
.woocommerce form .wooccm-clearfix:before,
|
19 |
-
.woocommerce form .wooccm-clearfix:after {
|
20 |
-
content: '';
|
21 |
-
display: table;
|
22 |
-
}
|
23 |
-
.woocommerce form .wooccm-clearfix:after {
|
24 |
-
clear: both;
|
25 |
-
}
|
26 |
-
.woocommerce form .wooccm-conditional-child {
|
27 |
-
display: none;
|
28 |
-
}
|
29 |
-
.woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label {
|
30 |
-
display: inline-block;
|
31 |
-
}
|
32 |
-
.woocommerce form .wooccm-colorpicker-iris .iris-picker {
|
33 |
-
display: none;
|
34 |
-
}
|
35 |
-
.woocommerce form .wooccm-colorpicker-iris.active .iris-picker {
|
36 |
-
display: block;
|
37 |
-
}
|
38 |
-
.button.fileinput-button {
|
39 |
-
position: relative;
|
40 |
-
overflow: hidden!important;
|
41 |
-
}
|
42 |
-
.button.fileinput-button input {
|
43 |
-
position: absolute;
|
44 |
-
top: 0;
|
45 |
-
right: 0;
|
46 |
-
margin: 0;
|
47 |
-
opacity: 0;
|
48 |
-
-ms-filter: 'alpha(opacity=0)';
|
49 |
-
font-size: 200px;
|
50 |
-
direction: ltr;
|
51 |
-
cursor: pointer;
|
52 |
-
}
|
53 |
-
.wooccm-file-list {
|
54 |
-
margin: 0 -5px;
|
55 |
-
padding: 0;
|
56 |
-
display: flex;
|
57 |
-
flex-wrap: wrap;
|
58 |
-
align-items: center;
|
59 |
-
justify-content: start;
|
60 |
-
}
|
61 |
-
.wooccm-file-list .wooccm-file-file {
|
62 |
-
display: flex;
|
63 |
-
justify-content: center;
|
64 |
-
align-items: stretch;
|
65 |
-
box-sizing: border-box;
|
66 |
-
padding: 10px 5px 0 5px;
|
67 |
-
width: 25%;
|
68 |
-
position: relative;
|
69 |
-
}
|
70 |
-
.wooccm-file-list .wooccm-file-file .wooccm-file-list-delete {
|
71 |
-
z-index: 1;
|
72 |
-
position: absolute;
|
73 |
-
top: 2px;
|
74 |
-
right: -3px;
|
75 |
-
width: 16px;
|
76 |
-
height: 16px;
|
77 |
-
background-color: #222;
|
78 |
-
display: block;
|
79 |
-
line-height: 16px;
|
80 |
-
text-align: center;
|
81 |
-
color: #fefefe;
|
82 |
-
font-weight: 900;
|
83 |
-
border-radius: 50%;
|
84 |
-
font-size: 12px;
|
85 |
-
cursor: pointer;
|
86 |
-
font-family: code;
|
87 |
-
text-decoration: none!important;
|
88 |
-
}
|
89 |
-
.wooccm-file-list .wooccm-file-file .wooccm-file-list-container {
|
90 |
-
width: 100%;
|
91 |
-
overflow: hidden;
|
92 |
-
}
|
93 |
-
.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container {
|
94 |
-
display: flex;
|
95 |
-
justify-content: center;
|
96 |
-
align-items: center;
|
97 |
-
overflow: hidden;
|
98 |
-
width: 100%;
|
99 |
-
padding-top: 100%;
|
100 |
-
position: relative;
|
101 |
-
background: #eee;
|
102 |
-
}
|
103 |
-
.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container > img {
|
104 |
-
overflow: hidden;
|
105 |
-
object-fit: cover;
|
106 |
-
position: absolute;
|
107 |
-
top: 30%;
|
108 |
-
bottom: auto;
|
109 |
-
height: 40%;
|
110 |
-
opacity: 0.8;
|
111 |
-
}
|
112 |
-
.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container > img.image {
|
113 |
-
top: 0;
|
114 |
-
bottom: 0;
|
115 |
-
left: 0;
|
116 |
-
right: 0;
|
117 |
-
max-height: 100%;
|
118 |
-
height: 100%;
|
119 |
-
width: 100%;
|
120 |
-
}
|
121 |
/*# sourceMappingURL=wooccm.css.map */
|
1 |
+
.woocommerce form {
|
2 |
+
/* @media (min-width: 768px) {
|
3 |
+
.wooccm-field {
|
4 |
+
&.form-row-first {
|
5 |
+
width: 47.0588235294%;
|
6 |
+
float: left;
|
7 |
+
margin-right: 5.8823529412%;
|
8 |
+
clear: both;
|
9 |
+
}
|
10 |
+
&.form-row-last {
|
11 |
+
width: 45.4545454545%;
|
12 |
+
float: right;
|
13 |
+
margin-right: 0;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
}*/
|
17 |
+
}
|
18 |
+
.woocommerce form .wooccm-clearfix:before,
|
19 |
+
.woocommerce form .wooccm-clearfix:after {
|
20 |
+
content: '';
|
21 |
+
display: table;
|
22 |
+
}
|
23 |
+
.woocommerce form .wooccm-clearfix:after {
|
24 |
+
clear: both;
|
25 |
+
}
|
26 |
+
.woocommerce form .wooccm-conditional-child {
|
27 |
+
display: none;
|
28 |
+
}
|
29 |
+
.woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label {
|
30 |
+
display: inline-block;
|
31 |
+
}
|
32 |
+
.woocommerce form .wooccm-colorpicker-iris .iris-picker {
|
33 |
+
display: none;
|
34 |
+
}
|
35 |
+
.woocommerce form .wooccm-colorpicker-iris.active .iris-picker {
|
36 |
+
display: block;
|
37 |
+
}
|
38 |
+
.button.fileinput-button {
|
39 |
+
position: relative;
|
40 |
+
overflow: hidden!important;
|
41 |
+
}
|
42 |
+
.button.fileinput-button input {
|
43 |
+
position: absolute;
|
44 |
+
top: 0;
|
45 |
+
right: 0;
|
46 |
+
margin: 0;
|
47 |
+
opacity: 0;
|
48 |
+
-ms-filter: 'alpha(opacity=0)';
|
49 |
+
font-size: 200px;
|
50 |
+
direction: ltr;
|
51 |
+
cursor: pointer;
|
52 |
+
}
|
53 |
+
.wooccm-file-list {
|
54 |
+
margin: 0 -5px;
|
55 |
+
padding: 0;
|
56 |
+
display: flex;
|
57 |
+
flex-wrap: wrap;
|
58 |
+
align-items: center;
|
59 |
+
justify-content: start;
|
60 |
+
}
|
61 |
+
.wooccm-file-list .wooccm-file-file {
|
62 |
+
display: flex;
|
63 |
+
justify-content: center;
|
64 |
+
align-items: stretch;
|
65 |
+
box-sizing: border-box;
|
66 |
+
padding: 10px 5px 0 5px;
|
67 |
+
width: 25%;
|
68 |
+
position: relative;
|
69 |
+
}
|
70 |
+
.wooccm-file-list .wooccm-file-file .wooccm-file-list-delete {
|
71 |
+
z-index: 1;
|
72 |
+
position: absolute;
|
73 |
+
top: 2px;
|
74 |
+
right: -3px;
|
75 |
+
width: 16px;
|
76 |
+
height: 16px;
|
77 |
+
background-color: #222;
|
78 |
+
display: block;
|
79 |
+
line-height: 16px;
|
80 |
+
text-align: center;
|
81 |
+
color: #fefefe;
|
82 |
+
font-weight: 900;
|
83 |
+
border-radius: 50%;
|
84 |
+
font-size: 12px;
|
85 |
+
cursor: pointer;
|
86 |
+
font-family: code;
|
87 |
+
text-decoration: none!important;
|
88 |
+
}
|
89 |
+
.wooccm-file-list .wooccm-file-file .wooccm-file-list-container {
|
90 |
+
width: 100%;
|
91 |
+
overflow: hidden;
|
92 |
+
}
|
93 |
+
.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container {
|
94 |
+
display: flex;
|
95 |
+
justify-content: center;
|
96 |
+
align-items: center;
|
97 |
+
overflow: hidden;
|
98 |
+
width: 100%;
|
99 |
+
padding-top: 100%;
|
100 |
+
position: relative;
|
101 |
+
background: #eee;
|
102 |
+
}
|
103 |
+
.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container > img {
|
104 |
+
overflow: hidden;
|
105 |
+
object-fit: cover;
|
106 |
+
position: absolute;
|
107 |
+
top: 30%;
|
108 |
+
bottom: auto;
|
109 |
+
height: 40%;
|
110 |
+
opacity: 0.8;
|
111 |
+
}
|
112 |
+
.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container > img.image {
|
113 |
+
top: 0;
|
114 |
+
bottom: 0;
|
115 |
+
left: 0;
|
116 |
+
right: 0;
|
117 |
+
max-height: 100%;
|
118 |
+
height: 100%;
|
119 |
+
width: 100%;
|
120 |
+
}
|
121 |
/*# sourceMappingURL=wooccm.css.map */
|
assets/frontend/css/wooccm.min.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
|
2 |
.woocommerce form .wooccm-clearfix:before,.woocommerce form .wooccm-clearfix:after{content:'';display:table}.woocommerce form .wooccm-clearfix:after{clear:both}.woocommerce form .wooccm-conditional-child{display:none}.woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label{display:inline-block}.woocommerce form .wooccm-colorpicker-iris .iris-picker{display:none}.woocommerce form .wooccm-colorpicker-iris.active .iris-picker{display:block}@media(min-width:768px){.woocommerce form .wooccm-field.form-row-first{width:47.0588235294%;float:left;margin-right:5.8823529412%;clear:both}.woocommerce form .wooccm-field.form-row-last{width:45.4545454545%;float:right;margin-right:0}}.button.fileinput-button{position:relative;overflow:hidden!important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}.wooccm-file-list{margin:0 -5px;padding:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:start}.wooccm-file-list .wooccm-file-file{display:flex;justify-content:center;align-items:stretch;box-sizing:border-box;padding:10px 5px 0 5px;width:25%;position:relative}.wooccm-file-list .wooccm-file-file .wooccm-file-list-delete{z-index:1;position:absolute;top:2px;right:-3px;width:16px;height:16px;background-color:#222;display:block;line-height:16px;text-align:center;color:#fefefe;font-weight:900;border-radius:50%;font-size:12px;cursor:pointer;font-family:code;text-decoration:none!important}.wooccm-file-list .wooccm-file-file .wooccm-file-list-container{width:100%;overflow:hidden}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container{display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;padding-top:100%;position:relative;background:#eee}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img{overflow:hidden;object-fit:cover;position:absolute;top:30%;bottom:auto;height:40%;opacity:.8}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img.image{top:0;bottom:0;left:0;right:0;max-height:100%;height:100%;width:100%}
|
1 |
+
|
2 |
.woocommerce form .wooccm-clearfix:before,.woocommerce form .wooccm-clearfix:after{content:'';display:table}.woocommerce form .wooccm-clearfix:after{clear:both}.woocommerce form .wooccm-conditional-child{display:none}.woocommerce form .wooccm-type-radio .woocommerce-radio-wrapper label{display:inline-block}.woocommerce form .wooccm-colorpicker-iris .iris-picker{display:none}.woocommerce form .wooccm-colorpicker-iris.active .iris-picker{display:block}@media(min-width:768px){.woocommerce form .wooccm-field.form-row-first{width:47.0588235294%;float:left;margin-right:5.8823529412%;clear:both}.woocommerce form .wooccm-field.form-row-last{width:45.4545454545%;float:right;margin-right:0}}.button.fileinput-button{position:relative;overflow:hidden!important}.button.fileinput-button input{position:absolute;top:0;right:0;margin:0;opacity:0;-ms-filter:'alpha(opacity=0)';font-size:200px;direction:ltr;cursor:pointer}.wooccm-file-list{margin:0 -5px;padding:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:start}.wooccm-file-list .wooccm-file-file{display:flex;justify-content:center;align-items:stretch;box-sizing:border-box;padding:10px 5px 0 5px;width:25%;position:relative}.wooccm-file-list .wooccm-file-file .wooccm-file-list-delete{z-index:1;position:absolute;top:2px;right:-3px;width:16px;height:16px;background-color:#222;display:block;line-height:16px;text-align:center;color:#fefefe;font-weight:900;border-radius:50%;font-size:12px;cursor:pointer;font-family:code;text-decoration:none!important}.wooccm-file-list .wooccm-file-file .wooccm-file-list-container{width:100%;overflow:hidden}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container{display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;padding-top:100%;position:relative;background:#eee}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img{overflow:hidden;object-fit:cover;position:absolute;top:30%;bottom:auto;height:40%;opacity:.8}.wooccm-file-list .wooccm-file-file .wooccm-file-list-image-container>img.image{top:0;bottom:0;left:0;right:0;max-height:100%;height:100%;width:100%}
|
assets/frontend/js/wooccm-checkout.js
CHANGED
@@ -1,516 +1,516 @@
|
|
1 |
-
(function ($) {
|
2 |
-
|
3 |
-
var is_blocked = function ($node) {
|
4 |
-
return $node.is('.processing') || $node.parents('.processing').length;
|
5 |
-
};
|
6 |
-
var block = function ($node) {
|
7 |
-
if (!is_blocked($node)) {
|
8 |
-
$node.addClass('processing').block({
|
9 |
-
message: null,
|
10 |
-
overlayCSS: {
|
11 |
-
background: '#fff',
|
12 |
-
opacity: 0.6
|
13 |
-
}
|
14 |
-
});
|
15 |
-
}
|
16 |
-
};
|
17 |
-
var unblock = function ($node) {
|
18 |
-
$node.removeClass('processing').unblock();
|
19 |
-
};
|
20 |
-
var append_image = function (list, i, source, name, filetype) {
|
21 |
-
|
22 |
-
var $field_list = $(list),
|
23 |
-
source_class;
|
24 |
-
if (filetype.match('image.*')) {
|
25 |
-
source_class = 'image';
|
26 |
-
} else if (filetype.match('application/ms.*')) {
|
27 |
-
source = wooccm_upload.icons.spreadsheet;
|
28 |
-
source_class = 'spreadsheet';
|
29 |
-
} else if (filetype.match('application/x.*')) {
|
30 |
-
source = wooccm_upload.icons.archive;
|
31 |
-
source_class = 'application';
|
32 |
-
} else if (filetype.match('audio.*')) {
|
33 |
-
source = wooccm_upload.icons.audio;
|
34 |
-
source_class = 'audio';
|
35 |
-
} else if (filetype.match('text.*')) {
|
36 |
-
source = wooccm_upload.icons.text;
|
37 |
-
source_class = 'text';
|
38 |
-
} else if (filetype.match('video.*')) {
|
39 |
-
source = wooccm_upload.icons.video;
|
40 |
-
source_class = 'video';
|
41 |
-
} else {
|
42 |
-
//if ((false === filetype.match('application/ms.*') && false === filetype.match('application/x.*') && false === filetype.match('audio.*') && false === filetype.match('text.*') && false === filetype.match('video.*')) || (0 === filetype.length || !filetype)) {
|
43 |
-
source = wooccm_upload.icons.interactive;
|
44 |
-
source_class = 'interactive';
|
45 |
-
}
|
46 |
-
|
47 |
-
|
48 |
-
var html = '<span data-file_id="' + i + '" title="' + name + '" class="wooccm-file-file">\n\
|
49 |
-
<span class="wooccm-file-list-container">\n\
|
50 |
-
<a title="' + name + '" class="wooccm-file-list-delete">×</a>\n\
|
51 |
-
<span class="wooccm-file-list-image-container">\n\
|
52 |
-
<img class="' + source_class + '" alt="' + name + '" src="' + source + '"/>\n\
|
53 |
-
</span>\n\
|
54 |
-
</span>\n\
|
55 |
-
</span>';
|
56 |
-
$field_list.append(html).fadeIn();
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
function field_is_required(field, is_required) {
|
61 |
-
if (is_required) {
|
62 |
-
field.find('label .optional').remove();
|
63 |
-
field.addClass('validate-required');
|
64 |
-
if (field.find('label .required').length === 0) {
|
65 |
-
field.find('label').append(
|
66 |
-
'<abbr class="required" title="' +
|
67 |
-
wc_address_i18n_params.i18n_required_text +
|
68 |
-
'">*</abbr>'
|
69 |
-
);
|
70 |
-
}
|
71 |
-
|
72 |
-
//fix state hidden
|
73 |
-
field.show();
|
74 |
-
field.find('input[type=hidden]').prop('type', 'text');
|
75 |
-
|
76 |
-
} else {
|
77 |
-
field.find('label .required').remove();
|
78 |
-
field.removeClass('validate-required woocommerce-invalid woocommerce-invalid-required-field');
|
79 |
-
if (field.find('label .optional').length === 0) {
|
80 |
-
field.find('label').append('<span class="optional">(' + wc_address_i18n_params.i18n_optional_text + ')</span>');
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
$(document).on('country_to_state_changing', function (event, country, wrapper) {
|
87 |
-
|
88 |
-
var thisform = wrapper, thislocale;
|
89 |
-
var locale_fields = $.parseJSON(wc_address_i18n_params.locale_fields);
|
90 |
-
$.each(locale_fields, function (key, value) {
|
91 |
-
|
92 |
-
var field = thisform.find(value),
|
93 |
-
required = field.find('[data-required]').data('required') || field.find('.wooccm-required-field').length;
|
94 |
-
|
95 |
-
field_is_required(field, required);
|
96 |
-
});
|
97 |
-
});
|
98 |
-
// Field
|
99 |
-
// ---------------------------------------------------------------------------
|
100 |
-
|
101 |
-
var fileList = {};
|
102 |
-
|
103 |
-
$('.wooccm-type-file').each(function (i, field) {
|
104 |
-
|
105 |
-
var $field = $(field),
|
106 |
-
$button_file = $field.find('[type=file]'),
|
107 |
-
$button_click = $field.find('.wooccm-file-button'),
|
108 |
-
$field_list = $field.find('.wooccm-file-list');
|
109 |
-
|
110 |
-
fileList[$field.attr('id')] = [];
|
111 |
-
|
112 |
-
// Simulate click
|
113 |
-
// -------------------------------------------------------------------------
|
114 |
-
|
115 |
-
$button_click.on('click', function (e) {
|
116 |
-
e.preventDefault();
|
117 |
-
$button_file.trigger('click');
|
118 |
-
});
|
119 |
-
|
120 |
-
// Delete images
|
121 |
-
// ---------------------------------------------------------------------------
|
122 |
-
|
123 |
-
$field_list.on('click', '.wooccm-file-list-delete', function (e) {
|
124 |
-
|
125 |
-
var $file = $(this).closest('.wooccm-file-file'),
|
126 |
-
file_id = $(this).closest('[data-file_id]').data('file_id');
|
127 |
-
|
128 |
-
fileList[$field.attr('id')] = $.grep(fileList[$field.attr('id')], function (value, index) {
|
129 |
-
return index != file_id;
|
130 |
-
});
|
131 |
-
|
132 |
-
$file.remove();
|
133 |
-
|
134 |
-
$('#order_review').trigger('wooccm_upload');
|
135 |
-
});
|
136 |
-
// Append images
|
137 |
-
// -------------------------------------------------------------------------
|
138 |
-
|
139 |
-
$button_file.on('change', function (e) {
|
140 |
-
|
141 |
-
var files = $(this)[0].files;
|
142 |
-
if (files.length) {
|
143 |
-
|
144 |
-
if (window.FileReader) {
|
145 |
-
|
146 |
-
$.each(files, function (i, file) {
|
147 |
-
|
148 |
-
var count = $field_list.find('span[data-file_id]').length + i;
|
149 |
-
if (count >= wooccm_upload.limit.max_files) {
|
150 |
-
alert('Exeeds max files limit of ' + wooccm_upload.limit.max_files);
|
151 |
-
return false;
|
152 |
-
}
|
153 |
-
|
154 |
-
if (file.size > wooccm_upload.limit.max_file_size) {
|
155 |
-
alert('Exeeds max file size of ' + wooccm_upload.limit.max_file_size);
|
156 |
-
return true;
|
157 |
-
}
|
158 |
-
|
159 |
-
reader = new FileReader();
|
160 |
-
reader.onload = (function (theFile) {
|
161 |
-
return function (e) {
|
162 |
-
setTimeout(function () {
|
163 |
-
append_image($field_list, fileList[$field.attr('id')].push(file) - 1, e.target.result, theFile.name, theFile.type);
|
164 |
-
$('#order_review').trigger('wooccm_upload');
|
165 |
-
}, 200);
|
166 |
-
};
|
167 |
-
})(file);
|
168 |
-
console.log(file.name);
|
169 |
-
reader.readAsDataURL(file);
|
170 |
-
});
|
171 |
-
}
|
172 |
-
}
|
173 |
-
});
|
174 |
-
});
|
175 |
-
// Add class on place order reload if upload field exists
|
176 |
-
// ---------------------------------------------------------------------------
|
177 |
-
|
178 |
-
// $(document).on('checkout_place_order_success', function (e) {
|
179 |
-
// alert('submit!');
|
180 |
-
// });
|
181 |
-
// $('form.checkout').on('checkout_place_order_success', function (e) {
|
182 |
-
// alert('submit!');
|
183 |
-
// });
|
184 |
-
$('#order_review').on('ajaxSuccess wooccm_upload', function (e, xhr, settings) {
|
185 |
-
|
186 |
-
// console.log('e', e);
|
187 |
-
// console.log('xhr', xhr);
|
188 |
-
// console.log('settings', settings);
|
189 |
-
|
190 |
-
var $order_review = $(e.target),
|
191 |
-
$place_order = $order_review.find('#place_order'),
|
192 |
-
$fields = $('.wooccm-type-file'),
|
193 |
-
fields = $fields.length;
|
194 |
-
|
195 |
-
if (fields) {
|
196 |
-
$place_order.addClass('wooccm-upload-process');
|
197 |
-
} else {
|
198 |
-
$place_order.removeClass('wooccm-upload-process');
|
199 |
-
}
|
200 |
-
|
201 |
-
});
|
202 |
-
// Upload files
|
203 |
-
// ---------------------------------------------------------------------------
|
204 |
-
|
205 |
-
$(document).on('click', '#place_order.wooccm-upload-process', function (e) {
|
206 |
-
|
207 |
-
e.preventDefault();
|
208 |
-
var $form = $('form.checkout'),
|
209 |
-
$place_order = $(this),
|
210 |
-
$fields = $('.wooccm-type-file');
|
211 |
-
|
212 |
-
if (!$fields.length) {
|
213 |
-
return;
|
214 |
-
}
|
215 |
-
|
216 |
-
if (!window.FormData) {
|
217 |
-
return;
|
218 |
-
}
|
219 |
-
|
220 |
-
if (!Object.keys(fileList).length) {
|
221 |
-
return;
|
222 |
-
}
|
223 |
-
|
224 |
-
if (!is_blocked($form)) {
|
225 |
-
$place_order.html(wooccm_upload.message.uploading);
|
226 |
-
block($form);
|
227 |
-
}
|
228 |
-
|
229 |
-
$.each(fileList, function (field_id, files) {
|
230 |
-
|
231 |
-
var $field = $('#' + field_id),
|
232 |
-
$attachment_ids = $field.find('.wooccm-file-field'),
|
233 |
-
data = new FormData();
|
234 |
-
|
235 |
-
$.each(files, function (file_id, file) {
|
236 |
-
|
237 |
-
if (file_id > wooccm_upload.limit.max_files) {
|
238 |
-
console.log('Exeeds max files limit of ' + wooccm_upload.limit.max_files);
|
239 |
-
return false;
|
240 |
-
}
|
241 |
-
|
242 |
-
if (file.size > wooccm_upload.limit.max_file_size) {
|
243 |
-
console.log('Exeeds max file size of ' + wooccm_upload.limit.max_files);
|
244 |
-
return true;
|
245 |
-
}
|
246 |
-
|
247 |
-
console.log('We\'re ready to upload ' + file.name);
|
248 |
-
|
249 |
-
data.append('wooccm_checkout_attachment_upload[]', file);
|
250 |
-
|
251 |
-
});
|
252 |
-
|
253 |
-
data.append('action', 'wooccm_checkout_attachment_upload');
|
254 |
-
data.append('nonce', wooccm_upload.nonce);
|
255 |
-
|
256 |
-
$.ajax({
|
257 |
-
async: false,
|
258 |
-
url: wooccm_upload.ajax_url,
|
259 |
-
type: 'POST',
|
260 |
-
cache: false,
|
261 |
-
data: data,
|
262 |
-
processData: false,
|
263 |
-
contentType: false,
|
264 |
-
beforeSend: function (response) {
|
265 |
-
//$place_order.html(wooccm_upload.message.uploading);
|
266 |
-
},
|
267 |
-
success: function (response) {
|
268 |
-
if (response.success) {
|
269 |
-
$attachment_ids.val(response.data);
|
270 |
-
} else {
|
271 |
-
$('body').trigger('update_checkout');
|
272 |
-
}
|
273 |
-
},
|
274 |
-
complete: function (response) {
|
275 |
-
}
|
276 |
-
});
|
277 |
-
|
278 |
-
});
|
279 |
-
|
280 |
-
unblock($form);
|
281 |
-
$place_order.removeClass('wooccm-upload-process').trigger('click');
|
282 |
-
|
283 |
-
});
|
284 |
-
// Update checkout fees
|
285 |
-
// ---------------------------------------------------------------------------
|
286 |
-
|
287 |
-
$(document).on('change', '.wooccm-add-price', function (e) {
|
288 |
-
$('body').trigger('update_checkout');
|
289 |
-
});
|
290 |
-
// Conditional
|
291 |
-
// ---------------------------------------------------------------------------
|
292 |
-
|
293 |
-
$('.wooccm-conditional-child').each(function (i, field) {
|
294 |
-
|
295 |
-
var $field = $(field),
|
296 |
-
$parent = $('#' + $field.find('[data-conditional-parent]').data('conditional-parent') + '_field'),
|
297 |
-
show_if_value = $field.find('[data-conditional-parent-value]').data('conditional-parent-value').toString();
|
298 |
-
if ($parent.length) {
|
299 |
-
|
300 |
-
$parent.on('wooccm_change change keyup', function (e) {
|
301 |
-
|
302 |
-
var $this = $(e.target),
|
303 |
-
value = $this.val();
|
304 |
-
// fix for select2 search
|
305 |
-
if ($this.hasClass('select2-selection')) {
|
306 |
-
return;
|
307 |
-
}
|
308 |
-
|
309 |
-
//make sure its a single checkbox otherwise return value
|
310 |
-
if ($this.prop('type') == 'checkbox') {
|
311 |
-
// fix for multicheckbox
|
312 |
-
if ($this.attr('name').indexOf('[]') !== -1) {
|
313 |
-
value = $parent.find('input:checked').map(function (i, e) {
|
314 |
-
return e.value
|
315 |
-
}).toArray();
|
316 |
-
} else {
|
317 |
-
value = $this.is(':checked');
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
if (show_if_value == value || ($.isArray(value) && value.indexOf(show_if_value) > -1)) {
|
322 |
-
$field.fadeIn();
|
323 |
-
} else {
|
324 |
-
$field.fadeOut();
|
325 |
-
}
|
326 |
-
|
327 |
-
$this.off('wooccm_change');
|
328 |
-
$this.off('change');
|
329 |
-
$this.off('keyup');
|
330 |
-
$field.trigger('change');
|
331 |
-
});
|
332 |
-
// dont use change event because trigger update_checkout event
|
333 |
-
$parent.find('select:first').trigger('wooccm_change');
|
334 |
-
$parent.find('textarea:first').trigger('wooccm_change');
|
335 |
-
$parent.find('input[type=button]:first').trigger('wooccm_change');
|
336 |
-
$parent.find('input[type=radio]:checked:first').trigger('wooccm_change');
|
337 |
-
$parent.find('input[type=checkbox]:checked:first').trigger('wooccm_change');
|
338 |
-
$parent.find('input[type=color]:first').trigger('wooccm_change');
|
339 |
-
$parent.find('input[type=date]:first').trigger('wooccm_change');
|
340 |
-
$parent.find('input[type=datetime-local]:first').trigger('wooccm_change');
|
341 |
-
$parent.find('input[type=email]:first').trigger('wooccm_change');
|
342 |
-
$parent.find('input[type=file]:first').trigger('wooccm_change');
|
343 |
-
$parent.find('input[type=hidden]:first').trigger('wooccm_change');
|
344 |
-
$parent.find('input[type=image]:first').trigger('wooccm_change');
|
345 |
-
$parent.find('input[type=month]:first').trigger('wooccm_change');
|
346 |
-
$parent.find('input[type=number]:first').trigger('wooccm_change');
|
347 |
-
$parent.find('input[type=password]:first').trigger('wooccm_change');
|
348 |
-
$parent.find('input[type=range]:first').trigger('wooccm_change');
|
349 |
-
$parent.find('input[type=reset]:first').trigger('wooccm_change');
|
350 |
-
$parent.find('input[type=search]:first').trigger('wooccm_change');
|
351 |
-
$parent.find('input[type=submit]:first').trigger('wooccm_change');
|
352 |
-
$parent.find('input[type=tel]:first').trigger('wooccm_change');
|
353 |
-
$parent.find('input[type=text]:first').trigger('wooccm_change');
|
354 |
-
$parent.find('input[type=time]:first').trigger('wooccm_change');
|
355 |
-
$parent.find('input[type=url]:first').trigger('wooccm_change');
|
356 |
-
$parent.find('input[type=week]:first').trigger('wooccm_change');
|
357 |
-
} else {
|
358 |
-
$field.show();
|
359 |
-
}
|
360 |
-
|
361 |
-
});
|
362 |
-
// Datepicker fields
|
363 |
-
// ---------------------------------------------------------------------------
|
364 |
-
|
365 |
-
$('.wooccm-enhanced-datepicker').each(function (i, field) {
|
366 |
-
|
367 |
-
var $input = $(this),
|
368 |
-
disable = $input.data('disable') || false;
|
369 |
-
|
370 |
-
console.log('mindate', $input.data('mindate'));
|
371 |
-
|
372 |
-
if ($.isFunction($.fn.datepicker)) {
|
373 |
-
$input.datepicker({
|
374 |
-
dateFormat: $input.data('formatdate') || 'dd-mm-yy',
|
375 |
-
minDate: $input.data('mindate'),
|
376 |
-
maxDate: $input.data('maxdate'),
|
377 |
-
beforeShowDay: function (date) {
|
378 |
-
var day = date.getDay().toString();
|
379 |
-
if (disable) {
|
380 |
-
return [$.inArray(day, disable) === -1];
|
381 |
-
}
|
382 |
-
return [true];
|
383 |
-
}
|
384 |
-
});
|
385 |
-
}
|
386 |
-
|
387 |
-
});
|
388 |
-
// Timepicker fields
|
389 |
-
// ---------------------------------------------------------------------------
|
390 |
-
|
391 |
-
$('.wooccm-enhanced-timepicker').each(function (i, field) {
|
392 |
-
|
393 |
-
var $input = $(this);
|
394 |
-
|
395 |
-
if ($.isFunction($.fn.timepicker)) {
|
396 |
-
$input.timepicker({
|
397 |
-
//timeFormat: 'HH:mm:ss',
|
398 |
-
showPeriod: true,
|
399 |
-
showLeadingZero: true,
|
400 |
-
hours: $input.data('hours') || undefined,
|
401 |
-
minutes: $input.data('minutes') || undefined,
|
402 |
-
});
|
403 |
-
}
|
404 |
-
|
405 |
-
});
|
406 |
-
// Color fields
|
407 |
-
// ---------------------------------------------------------------------------
|
408 |
-
|
409 |
-
$('.wooccm-colorpicker-farbtastic').each(function (i, field) {
|
410 |
-
|
411 |
-
var $field = $(field),
|
412 |
-
$input = $field.find('input[type=text]'),
|
413 |
-
$container = $field.find('.wooccmcolorpicker_container');
|
414 |
-
$input.hide();
|
415 |
-
if ($.isFunction($.fn.farbtastic)) {
|
416 |
-
|
417 |
-
$container.farbtastic('#' + $input.attr('id'));
|
418 |
-
$container.on('click', function (e) {
|
419 |
-
$input.fadeIn();
|
420 |
-
});
|
421 |
-
}
|
422 |
-
|
423 |
-
});
|
424 |
-
$('.wooccm-colorpicker-iris').each(function (i, field) {
|
425 |
-
|
426 |
-
var $field = $(field),
|
427 |
-
$input = $field.find('input[type=text]');
|
428 |
-
$input.css('background', $input.val());
|
429 |
-
$input.on('click', function (e) {
|
430 |
-
|
431 |
-
$field.toggleClass('active');
|
432 |
-
});
|
433 |
-
$input.iris({
|
434 |
-
class: $input.attr('id'),
|
435 |
-
palettes: true,
|
436 |
-
color: '',
|
437 |
-
hide: false,
|
438 |
-
change: function (event, ui) {
|
439 |
-
$input.css('background', ui.color.toString()).fadeIn();
|
440 |
-
}
|
441 |
-
});
|
442 |
-
});
|
443 |
-
$(document).on('click', function (e) {
|
444 |
-
if ($(e.target).closest('.iris-picker').length === 0) {
|
445 |
-
$('.wooccm-colorpicker-iris').removeClass('active');
|
446 |
-
}
|
447 |
-
});
|
448 |
-
|
449 |
-
if (typeof wc_country_select_params === 'undefined') {
|
450 |
-
return false;
|
451 |
-
}
|
452 |
-
|
453 |
-
if ($().selectWoo) {
|
454 |
-
var getEnhancedSelectFormatString = function () {
|
455 |
-
return {
|
456 |
-
'language': {
|
457 |
-
errorLoading: function () {
|
458 |
-
return wc_country_select_params.i18n_searching;
|
459 |
-
},
|
460 |
-
inputTooLong: function (args) {
|
461 |
-
var overChars = args.input.length - args.maximum;
|
462 |
-
if (1 === overChars) {
|
463 |
-
return wc_country_select_params.i18n_input_too_long_1;
|
464 |
-
}
|
465 |
-
|
466 |
-
return wc_country_select_params.i18n_input_too_long_n.replace('%qty%', overChars);
|
467 |
-
},
|
468 |
-
inputTooShort: function (args) {
|
469 |
-
var remainingChars = args.minimum - args.input.length;
|
470 |
-
if (1 === remainingChars) {
|
471 |
-
return wc_country_select_params.i18n_input_too_short_1;
|
472 |
-
}
|
473 |
-
|
474 |
-
return wc_country_select_params.i18n_input_too_short_n.replace('%qty%', remainingChars);
|
475 |
-
},
|
476 |
-
loadingMore: function () {
|
477 |
-
return wc_country_select_params.i18n_load_more;
|
478 |
-
},
|
479 |
-
maximumSelected: function (args) {
|
480 |
-
if (args.maximum === 1) {
|
481 |
-
return wc_country_select_params.i18n_selection_too_long_1;
|
482 |
-
}
|
483 |
-
return wc_country_select_params.i18n_selection_too_long_n.replace('%qty%', args.maximum);
|
484 |
-
},
|
485 |
-
noResults: function () {
|
486 |
-
return wc_country_select_params.i18n_no_matches;
|
487 |
-
},
|
488 |
-
searching: function () {
|
489 |
-
return wc_country_select_params.i18n_searching;
|
490 |
-
}
|
491 |
-
}
|
492 |
-
};
|
493 |
-
};
|
494 |
-
|
495 |
-
var wooccm_enhanced_select = function () {
|
496 |
-
$('select.wooccm-enhanced-select').each(function () {
|
497 |
-
var select2_args = $.extend({
|
498 |
-
width: '100%',
|
499 |
-
placeholder: $(this).data('placeholder') || '',
|
500 |
-
allowClear: $(this).data('allowclear') || false,
|
501 |
-
selectOnClose: $(this).data('selectonclose') || false,
|
502 |
-
closeOnSelect: $(this).data('closeonselect') || false,
|
503 |
-
//forceAbove: $(this).data('forceabove') || false,
|
504 |
-
minimumResultsForSearch: $(this).data('search') || -1,
|
505 |
-
}, getEnhancedSelectFormatString());
|
506 |
-
$(this).on('select2:select', function () {
|
507 |
-
$(this).focus();
|
508 |
-
}).selectWoo(select2_args);
|
509 |
-
});
|
510 |
-
};
|
511 |
-
|
512 |
-
wooccm_enhanced_select();
|
513 |
-
|
514 |
-
}
|
515 |
-
|
516 |
})(jQuery);
|
1 |
+
(function ($) {
|
2 |
+
|
3 |
+
var is_blocked = function ($node) {
|
4 |
+
return $node.is('.processing') || $node.parents('.processing').length;
|
5 |
+
};
|
6 |
+
var block = function ($node) {
|
7 |
+
if (!is_blocked($node)) {
|
8 |
+
$node.addClass('processing').block({
|
9 |
+
message: null,
|
10 |
+
overlayCSS: {
|
11 |
+
background: '#fff',
|
12 |
|