WooCommerce Checkout Manager - Version 4.8.1

Version Description

  • Fix: woocommerce checkout reorder field options
Download this release

Release Info

Developer quadlayers
Plugin Icon 128x128 WooCommerce Checkout Manager
Version 4.8.1
Comparing to
See all releases

Code changes from version 4.8.0 to 4.8.1

assets/backend/js/wooccm-admin-field.js CHANGED
@@ -2,11 +2,9 @@
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
-
10
  var block = function ($node) {
11
  if (!is_blocked($node)) {
12
  $node.addClass('processing').block({
@@ -18,11 +16,16 @@
18
  });
19
  }
20
  };
21
-
22
  var unblock = function ($node) {
23
  $node.removeClass('processing').unblock();
24
  };
25
-
 
 
 
 
 
 
26
  var FieldViewTabs = Backbone.View.extend({
27
  templates: {},
28
  initialize: function () {
@@ -33,7 +36,6 @@
33
  this.$el.trigger('wooccm-tab-panels');
34
  }
35
  });
36
-
37
  var FieldViewDatePickerLimit = Backbone.View.extend({
38
  templates: {},
39
  initialize: function () {
@@ -43,10 +45,8 @@
43
  this.$el.html(this.templates.window(this.model.attributes));
44
  this.$el.trigger('wooccm-enhanced-between-dates');
45
  this.$el.trigger('init_tooltips');
46
-
47
  }
48
  });
49
-
50
  var FieldViewPanels = Backbone.View.extend({
51
  templates: {},
52
  initialize: function () {
@@ -57,10 +57,8 @@
57
  this.$el.trigger('wooccm-enhanced-options');
58
  this.$el.trigger('wooccm-enhanced-select');
59
  this.$el.trigger('init_tooltips');
60
-
61
  }
62
  });
63
-
64
  var FieldViewInfo = Backbone.View.extend({
65
  templates: {},
66
  initialize: function () {
@@ -72,7 +70,6 @@
72
  this.$el.trigger('init_tooltips');
73
  }
74
  });
75
-
76
  var FieldView = Backbone.View.extend({
77
  events: {
78
  'change input': 'enable',
@@ -105,19 +102,15 @@
105
  render: function () {
106
 
107
  var modal = this;
108
-
109
  modal.$el.html(modal.templates.window(modal.model.attributes));
110
-
111
  this.tabs = new FieldViewTabs({model: modal.model});
112
  this.panels = new FieldViewPanels({model: modal.model});
113
  this.datepickerLimit = new FieldViewDatePickerLimit({model: modal.model});
114
  this.info = new FieldViewInfo({model: modal.model});
115
-
116
  this.assign(this.tabs, '#wooccm-modal-tabs');
117
  this.assign(this.panels, '#wooccm-modal-panels');
118
  this.assign(this.datepickerLimit, '#wooccm-modal-datepicker-limit');
119
  this.assign(this.info, '#wooccm-modal-info');
120
-
121
  // _.delay(function () {
122
  // modal.$el.trigger('wooccm-tab-panels');
123
  // }, 100);
@@ -126,12 +119,10 @@
126
  load: function () {
127
 
128
  var modal = this;
129
-
130
  if (modal.model.attributes.id == undefined) {
131
  modal.render();
132
  return;
133
  }
134
-
135
  $.ajax({
136
  url: wooccm_field.ajax_url,
137
  data: {
@@ -146,6 +137,7 @@
146
  },
147
  complete: function () {
148
  //unblock($tr);
 
149
  },
150
  error: function () {
151
  alert('Error!');
@@ -189,30 +181,25 @@
189
  open: function (e) {
190
 
191
  this.load();
192
-
193
  $('body').addClass('modal-open').append(this.$el);
194
  },
195
  update: function (e) {
196
 
197
  e.preventDefault();
198
-
199
  var $field = $(e.target),
200
  name = $field.attr('name'),
201
  value = $field.val();
202
-
203
  if (e.target.type === 'checkbox') {
204
  value = $field.prop('checked') === true ? 1 : 0;
205
  }
206
 
207
  this.model.attributes[name] = value;
208
  this.model.changed[name] = value;
209
-
210
  },
211
  change: function (e) {
212
  e.preventDefault();
213
  this.update(e);
214
  this.enable();
215
-
216
  },
217
  renderTabs: function () {
218
  this.tabs.render();
@@ -224,9 +211,9 @@
224
  this.info.render();
225
  },
226
  renderDate: function () {
 
227
  this.datepickerLimit.render();
228
  },
229
-
230
  // table: function (e) {
231
  // e.preventDefault();
232
  //
@@ -250,13 +237,10 @@
250
  },
251
  parent: function (e) {
252
  e.preventDefault();
253
-
254
  var modal = this,
255
  $modal = modal.$el.find('#wooccm_modal'),
256
  $details = $modal.find('.attachment-details');
257
-
258
  this.update(e);
259
-
260
  $.ajax({
261
  url: wooccm_field.ajax_url,
262
  data: {
@@ -289,9 +273,7 @@
289
  }
290
  }
291
  });
292
-
293
  return false;
294
-
295
  },
296
  reload: function (e) {
297
  if (this.$el.find('#wooccm_modal').hasClass('reload')) {
@@ -314,11 +296,9 @@
314
  },
315
  submit: function (e) {
316
  e.preventDefault();
317
-
318
  var modal = this,
319
  $modal = modal.$el.find('#wooccm_modal'),
320
  $details = $modal.find('.attachment-details');
321
-
322
  $.ajax({
323
  url: wooccm_field.ajax_url,
324
  data: {
@@ -362,43 +342,31 @@
362
  return false;
363
  }
364
  });
365
-
366
  var FieldModel = Backbone.Model.extend({
367
  defaults: wooccm_field.args
368
  });
369
-
370
  var FieldModal = Backbone.View.extend({
371
  initialize: function (e) {
372
 
373
  var $button = $(e.target),
374
  field_id = $button.closest('[data-field_id]').data('field_id');
375
-
376
  var model = new FieldModel();
377
-
378
  model.set({
379
  id: field_id
380
  });
381
-
382
  new FieldView({
383
  model: model
384
  });
385
  },
386
  });
387
-
388
  $('#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add').on('click', function (e) {
389
  e.preventDefault();
390
-
391
  new FieldModal(e);
392
  });
393
-
394
-
395
  $('#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset').on('click', function (e) {
396
  e.preventDefault();
397
-
398
  var $button = $(e.target);
399
-
400
  var c = confirm(wooccm_field.message.reset);
401
-
402
  if (!c) {
403
  return false;
404
  }
@@ -422,31 +390,23 @@
422
  if (response.success) {
423
 
424
  location.reload();
425
-
426
  } else {
427
  alert(response.data);
428
  }
429
  }
430
  });
431
-
432
  return false;
433
  });
434
-
435
  $('.wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit').on('click', function (e) {
436
  e.preventDefault();
437
-
438
  new FieldModal(e);
439
  });
440
-
441
  $('.wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete').on('click', function (e) {
442
  e.preventDefault();
443
-
444
  var $button = $(e.target),
445
  $field = $button.closest('[data-field_id]'),
446
  field_id = $field.data('field_id');
447
-
448
  var c = confirm(wooccm_field.message.remove);
449
-
450
  if (!c) {
451
  return false;
452
  }
@@ -471,23 +431,18 @@
471
  if (response.success) {
472
 
473
  $field.remove();
474
-
475
  } else {
476
  alert(response.data);
477
  }
478
  }
479
  });
480
-
481
  return false;
482
  });
483
-
484
  $(document).on('click', '.wooccm-field-toggle-attribute', function (e) {
485
  e.preventDefault();
486
-
487
  var $link = $(this),
488
  $tr = $link.closest('tr'),
489
  $toggle = $link.find('.woocommerce-input-toggle');
490
-
491
  $.ajax({
492
  url: wooccm_field.ajax_url,
493
  data: {
@@ -517,16 +472,12 @@
517
  }
518
 
519
  });
520
-
521
  return false;
522
  });
523
-
524
  $(document).on('change', '.wooccm-field-change-attribute', function (e) {
525
  e.preventDefault();
526
-
527
  var $change = $(this),
528
  $tr = $change.closest('tr');
529
-
530
  $.ajax({
531
  url: wooccm_field.ajax_url,
532
  data: {
@@ -550,7 +501,4 @@
550
  });
551
  return false;
552
  });
553
-
554
-
555
-
556
  })(jQuery);
2
 
3
  var count = 0,
4
  timer;
 
5
  var is_blocked = function ($node) {
6
  return $node.is('.processing') || $node.parents('.processing').length;
7
  };
 
8
  var block = function ($node) {
9
  if (!is_blocked($node)) {
10
  $node.addClass('processing').block({
16
  });
17
  }
18
  };
 
19
  var unblock = function ($node) {
20
  $node.removeClass('processing').unblock();
21
  };
22
+ _.mixin({
23
+ sortOptions: function (object) {
24
+ return _.sortBy(object, function (o) {
25
+ return o.order;
26
+ });
27
+ }
28
+ });
29
  var FieldViewTabs = Backbone.View.extend({
30
  templates: {},
31
  initialize: function () {
36
  this.$el.trigger('wooccm-tab-panels');
37
  }
38
  });
 
39
  var FieldViewDatePickerLimit = Backbone.View.extend({
40
  templates: {},
41
  initialize: function () {
45
  this.$el.html(this.templates.window(this.model.attributes));
46
  this.$el.trigger('wooccm-enhanced-between-dates');
47
  this.$el.trigger('init_tooltips');
 
48
  }
49
  });
 
50
  var FieldViewPanels = Backbone.View.extend({
51
  templates: {},
52
  initialize: function () {
57
  this.$el.trigger('wooccm-enhanced-options');
58
  this.$el.trigger('wooccm-enhanced-select');
59
  this.$el.trigger('init_tooltips');
 
60
  }
61
  });
 
62
  var FieldViewInfo = Backbone.View.extend({
63
  templates: {},
64
  initialize: function () {
70
  this.$el.trigger('init_tooltips');
71
  }
72
  });
 
73
  var FieldView = Backbone.View.extend({
74
  events: {
75
  'change input': 'enable',
102
  render: function () {
103
 
104
  var modal = this;
 
105
  modal.$el.html(modal.templates.window(modal.model.attributes));
 
106
  this.tabs = new FieldViewTabs({model: modal.model});
107
  this.panels = new FieldViewPanels({model: modal.model});
108
  this.datepickerLimit = new FieldViewDatePickerLimit({model: modal.model});
109
  this.info = new FieldViewInfo({model: modal.model});
 
110
  this.assign(this.tabs, '#wooccm-modal-tabs');
111
  this.assign(this.panels, '#wooccm-modal-panels');
112
  this.assign(this.datepickerLimit, '#wooccm-modal-datepicker-limit');
113
  this.assign(this.info, '#wooccm-modal-info');
 
114
  // _.delay(function () {
115
  // modal.$el.trigger('wooccm-tab-panels');
116
  // }, 100);
119
  load: function () {
120
 
121
  var modal = this;
 
122
  if (modal.model.attributes.id == undefined) {
123
  modal.render();
124
  return;
125
  }
 
126
  $.ajax({
127
  url: wooccm_field.ajax_url,
128
  data: {
137
  },
138
  complete: function () {
139
  //unblock($tr);
140
+ //modal.render();
141
  },
142
  error: function () {
143
  alert('Error!');
181
  open: function (e) {
182
 
183
  this.load();
 
184
  $('body').addClass('modal-open').append(this.$el);
185
  },
186
  update: function (e) {
187
 
188
  e.preventDefault();
 
189
  var $field = $(e.target),
190
  name = $field.attr('name'),
191
  value = $field.val();
 
192
  if (e.target.type === 'checkbox') {
193
  value = $field.prop('checked') === true ? 1 : 0;
194
  }
195
 
196
  this.model.attributes[name] = value;
197
  this.model.changed[name] = value;
 
198
  },
199
  change: function (e) {
200
  e.preventDefault();
201
  this.update(e);
202
  this.enable();
 
203
  },
204
  renderTabs: function () {
205
  this.tabs.render();
211
  this.info.render();
212
  },
213
  renderDate: function () {
214
+ this.assign(this.datepickerLimit, '#wooccm-modal-datepicker-limit');
215
  this.datepickerLimit.render();
216
  },
 
217
  // table: function (e) {
218
  // e.preventDefault();
219
  //
237
  },
238
  parent: function (e) {
239
  e.preventDefault();
 
240
  var modal = this,
241
  $modal = modal.$el.find('#wooccm_modal'),
242
  $details = $modal.find('.attachment-details');
 
243
  this.update(e);
 
244
  $.ajax({
245
  url: wooccm_field.ajax_url,
246
  data: {
273
  }
274
  }
275
  });
 
276
  return false;
 
277
  },
278
  reload: function (e) {
279
  if (this.$el.find('#wooccm_modal').hasClass('reload')) {
296
  },
297
  submit: function (e) {
298
  e.preventDefault();
 
299
  var modal = this,
300
  $modal = modal.$el.find('#wooccm_modal'),
301
  $details = $modal.find('.attachment-details');
 
302
  $.ajax({
303
  url: wooccm_field.ajax_url,
304
  data: {
342
  return false;
343
  }
344
  });
 
345
  var FieldModel = Backbone.Model.extend({
346
  defaults: wooccm_field.args
347
  });
 
348
  var FieldModal = Backbone.View.extend({
349
  initialize: function (e) {
350
 
351
  var $button = $(e.target),
352
  field_id = $button.closest('[data-field_id]').data('field_id');
 
353
  var model = new FieldModel();
 
354
  model.set({
355
  id: field_id
356
  });
 
357
  new FieldView({
358
  model: model
359
  });
360
  },
361
  });
 
362
  $('#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add').on('click', function (e) {
363
  e.preventDefault();
 
364
  new FieldModal(e);
365
  });
 
 
366
  $('#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset').on('click', function (e) {
367
  e.preventDefault();
 
368
  var $button = $(e.target);
 
369
  var c = confirm(wooccm_field.message.reset);
 
370
  if (!c) {
371
  return false;
372
  }
390
  if (response.success) {
391
 
392
  location.reload();
 
393
  } else {
394
  alert(response.data);
395
  }
396
  }
397
  });
 
398
  return false;
399
  });
 
400
  $('.wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit').on('click', function (e) {
401
  e.preventDefault();
 
402
  new FieldModal(e);
403
  });
 
404
  $('.wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete').on('click', function (e) {
405
  e.preventDefault();
 
406
  var $button = $(e.target),
407
  $field = $button.closest('[data-field_id]'),
408
  field_id = $field.data('field_id');
 
409
  var c = confirm(wooccm_field.message.remove);
 
410
  if (!c) {
411
  return false;
412
  }
431
  if (response.success) {
432
 
433
  $field.remove();
 
434
  } else {
435
  alert(response.data);
436
  }
437
  }
438
  });
 
439
  return false;
440
  });
 
441
  $(document).on('click', '.wooccm-field-toggle-attribute', function (e) {
442
  e.preventDefault();
 
443
  var $link = $(this),
444
  $tr = $link.closest('tr'),
445
  $toggle = $link.find('.woocommerce-input-toggle');
 
446
  $.ajax({
447
  url: wooccm_field.ajax_url,
448
  data: {
472
  }
473
 
474
  });
 
475
  return false;
476
  });
 
477
  $(document).on('change', '.wooccm-field-change-attribute', function (e) {
478
  e.preventDefault();
 
479
  var $change = $(this),
480
  $tr = $change.closest('tr');
 
481
  $.ajax({
482
  url: wooccm_field.ajax_url,
483
  data: {
501
  });
502
  return false;
503
  });
 
 
 
504
  })(jQuery);
assets/backend/js/wooccm-admin-field.min.js CHANGED
@@ -1 +1 @@
1
- (function(f){var h=0,b;var e=function(n){return n.is(".processing")||n.parents(".processing").length};var d=function(n){if(!e(n)){n.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var g=function(n){n.removeClass("processing").unblock()};var c=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-tabs")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-tab-panels")}});var l=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-datepicker-limit")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-enhanced-between-dates");this.$el.trigger("init_tooltips")}});var m=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-panels")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-enhanced-options");this.$el.trigger("wooccm-enhanced-select");this.$el.trigger("init_tooltips")}});var k=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-info")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-enhanced-select");this.$el.trigger("init_tooltips")}});var j=Backbone.View.extend({events:{"change input":"enable","change textarea":"enable","change select":"enable","click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","change .media-modal-change":"change","change .media-modal-parent":"parent","change .media-modal-render-tabs":"renderTabs","change .media-modal-render-panels":"renderPanels","change .media-modal-render-info":"renderInfo","change .media-modal-render-datepicker-limit":"renderDate","submit .media-modal-form":"submit",},templates:{},initialize:function(){_.bindAll(this,"open","edit","parent","change","load","render","close","submit");this.init();this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-main")},assign:function(o,n){o.setElement(this.$(n)).render()},render:function(){var n=this;n.$el.html(n.templates.window(n.model.attributes));this.tabs=new c({model:n.model});this.panels=new m({model:n.model});this.datepickerLimit=new l({model:n.model});this.info=new k({model:n.model});this.assign(this.tabs,"#wooccm-modal-tabs");this.assign(this.panels,"#wooccm-modal-panels");this.assign(this.datepickerLimit,"#wooccm-modal-datepicker-limit");this.assign(this.info,"#wooccm-modal-info")},load:function(){var n=this;if(n.model.attributes.id==undefined){n.render();return}f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_field",nonce:wooccm_field.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(o){if(o.success){n.model.set(o.data);n.render()}else{alert(o.data)}}})},edit:function(r){r.preventDefault();var p=this,q=f(r.target),o=parseInt(f(".wc_gateways tr[data-field_id]").length),n=parseInt(p.model.get("order"));h++;if(b){clearTimeout(b)}b=setTimeout(function(){if(q.hasClass("media-modal-next")){n=Math.min(n+h,o)}else{n=Math.max(n-h,1)}p.model.set({id:parseInt(f(".wc_gateways tr[data-field_order="+n+"]").data("field_id"))});h=0;p.load()},300)},open:function(n){this.load();f("body").addClass("modal-open").append(this.$el)},update:function(q){q.preventDefault();var o=f(q.target),n=o.attr("name"),p=o.val();if(q.target.type==="checkbox"){p=o.prop("checked")===true?1:0}this.model.attributes[n]=p;this.model.changed[n]=p},change:function(n){n.preventDefault();this.update(n);this.enable()},renderTabs:function(){this.tabs.render()},renderPanels:function(){this.panels.render()},renderInfo:function(){this.info.render()},renderDate:function(){this.datepickerLimit.render()},close:function(n){n.preventDefault();this.undelegateEvents();f(document).off("focusin");f("body").removeClass("modal-open");this.remove()},parent:function(q){q.preventDefault();var p=this,o=p.$el.find("#wooccm_modal"),n=o.find(".attachment-details");this.update(q);f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_parent",nonce:wooccm_field.nonce,conditional_parent_key:p.model.attributes.conditional_parent_key},dataType:"json",type:"POST",beforeSend:function(){f(".media-modal-submit").attr("disabled",true);n.addClass("save-waiting")},complete:function(){n.addClass("save-complete");n.removeClass("save-waiting")},error:function(){alert("Error!")},success:function(r){if(r.success){p.model.attributes.parent=r.data;p.model.changed.parent=r.data;p.renderInfo()}else{alert(r.data)}}});return false},reload:function(n){if(this.$el.find("#wooccm_modal").hasClass("reload")){location.reload();return}this.remove();return},close:function(n){n.preventDefault();this.undelegateEvents();f(document).off("focusin");f("body").removeClass("modal-open");this.reload(n);return},enable:function(n){f(".media-modal-submit").removeProp("disabled")},submit:function(q){q.preventDefault();var p=this,o=p.$el.find("#wooccm_modal"),n=o.find(".attachment-details");f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_id:p.model.attributes.id,field_data:f("form",this.$el).serialize()},dataType:"json",type:"POST",beforeSend:function(){f(".media-modal-submit").prop("disabled",true);n.addClass("save-waiting");d(o)},complete:function(){n.addClass("save-complete");n.removeClass("save-waiting");g(o)},error:function(){alert("Error!")},success:function(r){if(r.success){if(p.model.attributes.id==undefined){o.addClass("reload");p.close(q)}p.model.set(r.data)}else{alert(r.data)}}});return false}});var i=Backbone.Model.extend({defaults:wooccm_field.args});var a=Backbone.View.extend({initialize:function(q){var p=f(q.target),o=p.closest("[data-field_id]").data("field_id");var n=new i();n.set({id:o});new j({model:n})},});f("#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",function(n){n.preventDefault();new a(n)});f("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",function(o){o.preventDefault();var n=f(o.target);var p=confirm(wooccm_field.message.reset);if(!p){return false}f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_reset_fields",nonce:wooccm_field.nonce},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(q){if(q.success){location.reload()}else{alert(q.data)}}});return false});f(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",function(n){n.preventDefault();new a(n)});f(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",function(q){q.preventDefault();var p=f(q.target),o=p.closest("[data-field_id]"),n=o.data("field_id");var r=confirm(wooccm_field.message.remove);if(!r){return false}f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_field.nonce,field_id:n,},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(s){if(s.success){o.remove()}else{alert(s.data)}}});return false});f(document).on("click",".wooccm-field-toggle-attribute",function(q){q.preventDefault();var n=f(this),p=n.closest("tr"),o=n.find(".woocommerce-input-toggle");f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:f(this).data("field_attr"),field_id:p.data("field_id")},dataType:"json",type:"POST",beforeSend:function(r){o.addClass("woocommerce-input-toggle--loading")},success:function(r){if(true===r.data){o.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");o.addClass("woocommerce-input-toggle--enabled");o.removeClass("woocommerce-input-toggle--loading")}else{if(true!==r.data){o.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");o.addClass("woocommerce-input-toggle--disabled");o.removeClass("woocommerce-input-toggle--loading")}}}});return false});f(document).on("change",".wooccm-field-change-attribute",function(p){p.preventDefault();var n=f(this),o=n.closest("tr");f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_change_field_attribute",nonce:wooccm_field.nonce,field_attr:n.data("field_attr"),field_value:n.val(),field_id:o.data("field_id"),},dataType:"json",type:"POST",beforeSend:function(q){n.prop("disabled",true)},success:function(q){console.log(q.data)},complete:function(q){n.prop("disabled",false)},});return false})})(jQuery);
1
+ (function(f){var h=0,b;var e=function(n){return n.is(".processing")||n.parents(".processing").length};var d=function(n){if(!e(n)){n.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:0.6}})}};var g=function(n){n.removeClass("processing").unblock()};_.mixin({sortOptions:function(n){return _.sortBy(n,function(p){return p.order})}});var c=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-tabs")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-tab-panels")}});var l=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-datepicker-limit")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-enhanced-between-dates");this.$el.trigger("init_tooltips")}});var m=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-panels")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-enhanced-options");this.$el.trigger("wooccm-enhanced-select");this.$el.trigger("init_tooltips")}});var k=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-info")},render:function(){this.$el.html(this.templates.window(this.model.attributes));this.$el.trigger("wooccm-enhanced-select");this.$el.trigger("init_tooltips")}});var j=Backbone.View.extend({events:{"change input":"enable","change textarea":"enable","change select":"enable","click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","change .media-modal-change":"change","change .media-modal-parent":"parent","change .media-modal-render-tabs":"renderTabs","change .media-modal-render-panels":"renderPanels","change .media-modal-render-info":"renderInfo","change .media-modal-render-datepicker-limit":"renderDate","submit .media-modal-form":"submit",},templates:{},initialize:function(){_.bindAll(this,"open","edit","parent","change","load","render","close","submit");this.init();this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-main")},assign:function(o,n){o.setElement(this.$(n)).render()},render:function(){var n=this;n.$el.html(n.templates.window(n.model.attributes));this.tabs=new c({model:n.model});this.panels=new m({model:n.model});this.datepickerLimit=new l({model:n.model});this.info=new k({model:n.model});this.assign(this.tabs,"#wooccm-modal-tabs");this.assign(this.panels,"#wooccm-modal-panels");this.assign(this.datepickerLimit,"#wooccm-modal-datepicker-limit");this.assign(this.info,"#wooccm-modal-info")},load:function(){var n=this;if(n.model.attributes.id==undefined){n.render();return}f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_field",nonce:wooccm_field.nonce,field_id:this.model.attributes.id},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(o){if(o.success){n.model.set(o.data);n.render()}else{alert(o.data)}}})},edit:function(r){r.preventDefault();var p=this,q=f(r.target),o=parseInt(f(".wc_gateways tr[data-field_id]").length),n=parseInt(p.model.get("order"));h++;if(b){clearTimeout(b)}b=setTimeout(function(){if(q.hasClass("media-modal-next")){n=Math.min(n+h,o)}else{n=Math.max(n-h,1)}p.model.set({id:parseInt(f(".wc_gateways tr[data-field_order="+n+"]").data("field_id"))});h=0;p.load()},300)},open:function(n){this.load();f("body").addClass("modal-open").append(this.$el)},update:function(q){q.preventDefault();var o=f(q.target),n=o.attr("name"),p=o.val();if(q.target.type==="checkbox"){p=o.prop("checked")===true?1:0}this.model.attributes[n]=p;this.model.changed[n]=p},change:function(n){n.preventDefault();this.update(n);this.enable()},renderTabs:function(){this.tabs.render()},renderPanels:function(){this.panels.render()},renderInfo:function(){this.info.render()},renderDate:function(){this.assign(this.datepickerLimit,"#wooccm-modal-datepicker-limit");this.datepickerLimit.render()},close:function(n){n.preventDefault();this.undelegateEvents();f(document).off("focusin");f("body").removeClass("modal-open");this.remove()},parent:function(q){q.preventDefault();var p=this,o=p.$el.find("#wooccm_modal"),n=o.find(".attachment-details");this.update(q);f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_parent",nonce:wooccm_field.nonce,conditional_parent_key:p.model.attributes.conditional_parent_key},dataType:"json",type:"POST",beforeSend:function(){f(".media-modal-submit").attr("disabled",true);n.addClass("save-waiting")},complete:function(){n.addClass("save-complete");n.removeClass("save-waiting")},error:function(){alert("Error!")},success:function(r){if(r.success){p.model.attributes.parent=r.data;p.model.changed.parent=r.data;p.renderInfo()}else{alert(r.data)}}});return false},reload:function(n){if(this.$el.find("#wooccm_modal").hasClass("reload")){location.reload();return}this.remove();return},close:function(n){n.preventDefault();this.undelegateEvents();f(document).off("focusin");f("body").removeClass("modal-open");this.reload(n);return},enable:function(n){f(".media-modal-submit").removeProp("disabled")},submit:function(q){q.preventDefault();var p=this,o=p.$el.find("#wooccm_modal"),n=o.find(".attachment-details");f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_id:p.model.attributes.id,field_data:f("form",this.$el).serialize()},dataType:"json",type:"POST",beforeSend:function(){f(".media-modal-submit").prop("disabled",true);n.addClass("save-waiting");d(o)},complete:function(){n.addClass("save-complete");n.removeClass("save-waiting");g(o)},error:function(){alert("Error!")},success:function(r){if(r.success){if(p.model.attributes.id==undefined){o.addClass("reload");p.close(q)}p.model.set(r.data)}else{alert(r.data)}}});return false}});var i=Backbone.Model.extend({defaults:wooccm_field.args});var a=Backbone.View.extend({initialize:function(q){var p=f(q.target),o=p.closest("[data-field_id]").data("field_id");var n=new i();n.set({id:o});new j({model:n})},});f("#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",function(n){n.preventDefault();new a(n)});f("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",function(o){o.preventDefault();var n=f(o.target);var p=confirm(wooccm_field.message.reset);if(!p){return false}f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_reset_fields",nonce:wooccm_field.nonce},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(q){if(q.success){location.reload()}else{alert(q.data)}}});return false});f(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",function(n){n.preventDefault();new a(n)});f(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",function(q){q.preventDefault();var p=f(q.target),o=p.closest("[data-field_id]"),n=o.data("field_id");var r=confirm(wooccm_field.message.remove);if(!r){return false}f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_field.nonce,field_id:n,},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(s){if(s.success){o.remove()}else{alert(s.data)}}});return false});f(document).on("click",".wooccm-field-toggle-attribute",function(q){q.preventDefault();var n=f(this),p=n.closest("tr"),o=n.find(".woocommerce-input-toggle");f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:f(this).data("field_attr"),field_id:p.data("field_id")},dataType:"json",type:"POST",beforeSend:function(r){o.addClass("woocommerce-input-toggle--loading")},success:function(r){if(true===r.data){o.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");o.addClass("woocommerce-input-toggle--enabled");o.removeClass("woocommerce-input-toggle--loading")}else{if(true!==r.data){o.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled");o.addClass("woocommerce-input-toggle--disabled");o.removeClass("woocommerce-input-toggle--loading")}}}});return false});f(document).on("change",".wooccm-field-change-attribute",function(p){p.preventDefault();var n=f(this),o=n.closest("tr");f.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_change_field_attribute",nonce:wooccm_field.nonce,field_attr:n.data("field_attr"),field_value:n.val(),field_id:o.data("field_id"),},dataType:"json",type:"POST",beforeSend:function(q){n.prop("disabled",true)},success:function(q){console.log(q.data)},complete:function(q){n.prop("disabled",false)},});return false})})(jQuery);
assets/backend/js/wooccm-admin.js CHANGED
@@ -110,6 +110,33 @@
110
 
111
  $(document).on('wooccm-enhanced-options', function (e) {
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  $('.wooccm-enhanced-options').each(function () {
114
 
115
  var $table = $(this),
@@ -120,9 +147,9 @@
120
 
121
  var $tr = $table.find('tbody > tr'),
122
  id = $tr.length,
123
- 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 + '"');
124
 
125
- $tr.last().after($('<tr class="row">' + tr + '</tr>'));
126
 
127
  $remove.removeProp('disabled');
128
 
110
 
111
  $(document).on('wooccm-enhanced-options', function (e) {
112
 
113
+ $('table.wc_gateways tbody').sortable({
114
+ items: 'tr',
115
+ cursor: 'move',
116
+ axis: 'y',
117
+ handle: 'td.sort',
118
+ scrollSensitivity: 40,
119
+ helper: function (event, ui) {
120
+ ui.children().each(function () {
121
+ $(this).width($(this).width());
122
+ });
123
+ ui.css('left', '0');
124
+ return ui;
125
+ },
126
+ start: function (event, ui) {
127
+ ui.item.css('background-color', '#f6f6f6');
128
+ },
129
+ stop: function (event, ui) {
130
+ ui.item.removeAttr('style');
131
+ ui.item.trigger('updateMoveButtons');
132
+ },
133
+ update: function (event, ui) {
134
+ $(this).find('tr').each(function (i, tr) {
135
+ $(tr).find('input.add-order').val(i).trigger('change');
136
+ });
137
+ }
138
+ });
139
+
140
  $('.wooccm-enhanced-options').each(function () {
141
 
142
  var $table = $(this),
147
 
148
  var $tr = $table.find('tbody > tr'),
149
  id = $tr.length,
150
+ 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 + '"');
151
 
152
+ $tr.last().after($('<tr class="row">' + tr + '</tr>')).find('input').trigger('change');
153
 
154
  $remove.removeProp('disabled');
155
 
assets/backend/js/wooccm-admin.min.js CHANGED
@@ -1 +1 @@
1
- (function(b){b(".wooccm-premium-field").closest("tr").addClass("wooccm-premium");function c(f){var e=b(f).next().is(".hasDatepicker")?"minDate":"maxDate",g="minDate"===e?b(f).next():b(f).prev(),d=b(f).datepicker("getDate");b(g).datepicker("option",e,d);b(f).change()}function a(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(d){var e=d.input.length-d.maximum;if(1===e){return wc_enhanced_select_params.i18n_input_too_long_1}return wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(d){var e=d.minimum-d.input.length;if(1===e){return wc_enhanced_select_params.i18n_input_too_short_1}return wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(d){if(d.maximum===1){return wc_enhanced_select_params.i18n_selection_too_long_1}return wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",d.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}b(document).on("wooccm-tab-panels",function(i,h){var g=b(i.target),f=g.find("ul.wc-tabs"),d=f.find('a[href="'+h+'"]');f.show();f.find("a").click(function(k){k.preventDefault();var j=b(this).closest("div.panel-wrap");f.find("li",j).removeClass("active");b(this).parent().addClass("active");b("div.panel",j).hide();b(b(this).attr("href")).show()});if(d.length&&b(d.attr("href")).length){d.click()}else{f.find("li.active").find("a").click()}});b(document).on("wooccm-enhanced-between-dates",function(d){b(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each(function(){b(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,onSelect:function(){c(b(this))}});b(this).find("input").each(function(){c(b(this))})})});b(document).on("wooccm-enhanced-options",function(d){b(".wooccm-enhanced-options").each(function(){var f=b(this),g=f.find(".add-option"),e=f.find(".remove-options");g.on("click",function(j){var h=f.find("tbody > tr"),k=h.length,i=h.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+k+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+k+'"');h.last().after(b('<tr class="row">'+i+"</tr>"));e.removeProp("disabled")});e.on("click",function(i){f.find("tr > td.check-column input:checked").closest("tr").remove();var h=f.find("tbody > tr");if(h.length<2){b(this).prop("disabled",true)}})})});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-select").filter(":not(.enhanced)").each(function(){var e=b.extend({minimumResultsForSearch:10,allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder")},a());b(this).selectWoo(e).addClass("enhanced")});b(".wooccm-product-search").filter(":not(.enhanced)").each(function(){var g={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):"3",escapeMarkup:function(h){return h},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(h){return{term:h.term,action:b(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:b(this).select2("val")||0,exclude:b(this).data("exclude"),include:b(this).data("include"),limit:b(this).data("limit"),display_stock:b(this).data("display_stock")}},processResults:function(i){var h=[];if(i){b.each(i,function(k,j){h.push({id:k,text:j})})}return{results:h}},cache:true}};g=b.extend(g,a());b(this).selectWoo(g).addClass("enhanced");if(b(this).data("sortable")){var f=b(this);var e=b(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){b(e.find(".select2-selection__choice").get().reverse()).each(function(){var i=b(this).data("data").id;var h=f.find('option[value="'+i+'"]')[0];f.prepend(h)})}})}else{if(b(this).prop("multiple")){b(this).on("change",function(){var h=b(this).children();h.sort(function(j,i){var l=j.text.toLowerCase();var k=i.text.toLowerCase();if(l>k){return 1}if(l<k){return -1}return 0});b(this).html(h)})}}})});b(".wooccm-enhanced-search").filter(":not(.enhanced)").each(function(){var d={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")||"3",escapeMarkup:function(e){return e},ajax:{url:wooccm_admin.ajax_url,dataType:"json",cache:true,delay:250,data:function(e){return{term:e.term,key:b(this).data("key"),action:"wooccm_search_field",nonce:wooccm_admin.nonce,}},processResults:function(f,g){var e=[];if(f){b.each(f,function(i,h){e.push({id:i,text:h})})}return{results:e}}}};d=b.extend(d,a());b(this).select2(d).addClass("enhanced")})})(jQuery);
1
+ (function(b){b(".wooccm-premium-field").closest("tr").addClass("wooccm-premium");function c(f){var e=b(f).next().is(".hasDatepicker")?"minDate":"maxDate",g="minDate"===e?b(f).next():b(f).prev(),d=b(f).datepicker("getDate");b(g).datepicker("option",e,d);b(f).change()}function a(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(d){var e=d.input.length-d.maximum;if(1===e){return wc_enhanced_select_params.i18n_input_too_long_1}return wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",e)},inputTooShort:function(d){var e=d.minimum-d.input.length;if(1===e){return wc_enhanced_select_params.i18n_input_too_short_1}return wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",e)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(d){if(d.maximum===1){return wc_enhanced_select_params.i18n_selection_too_long_1}return wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",d.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}b(document).on("wooccm-tab-panels",function(i,h){var g=b(i.target),f=g.find("ul.wc-tabs"),d=f.find('a[href="'+h+'"]');f.show();f.find("a").click(function(k){k.preventDefault();var j=b(this).closest("div.panel-wrap");f.find("li",j).removeClass("active");b(this).parent().addClass("active");b("div.panel",j).hide();b(b(this).attr("href")).show()});if(d.length&&b(d.attr("href")).length){d.click()}else{f.find("li.active").find("a").click()}});b(document).on("wooccm-enhanced-between-dates",function(d){b(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each(function(){b(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:true,onSelect:function(){c(b(this))}});b(this).find("input").each(function(){c(b(this))})})});b(document).on("wooccm-enhanced-options",function(d){b("table.wc_gateways tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,f){f.children().each(function(){b(this).width(b(this).width())});f.css("left","0");return f},start:function(e,f){f.item.css("background-color","#f6f6f6")},stop:function(e,f){f.item.removeAttr("style");f.item.trigger("updateMoveButtons")},update:function(e,f){b(this).find("tr").each(function(g,h){b(h).find("input.add-order").val(g).trigger("change")})}});b(".wooccm-enhanced-options").each(function(){var f=b(this),g=f.find(".add-option"),e=f.find(".remove-options");g.on("click",function(j){var h=f.find("tbody > tr"),k=h.length,i=h.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+k+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+k+'"').replace('<input value="0"','<input value="'+k+'"');h.last().after(b('<tr class="row">'+i+"</tr>")).find("input").trigger("change");e.removeProp("disabled")});e.on("click",function(i){f.find("tr > td.check-column input:checked").closest("tr").remove();var h=f.find("tbody > tr");if(h.length<2){b(this).prop("disabled",true)}})})});b(document).on("wooccm-enhanced-select",function(d){b(".wooccm-enhanced-select").filter(":not(.enhanced)").each(function(){var e=b.extend({minimumResultsForSearch:10,allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder")},a());b(this).selectWoo(e).addClass("enhanced")});b(".wooccm-product-search").filter(":not(.enhanced)").each(function(){var g={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")?b(this).data("minimum_input_length"):"3",escapeMarkup:function(h){return h},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(h){return{term:h.term,action:b(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:b(this).select2("val")||0,exclude:b(this).data("exclude"),include:b(this).data("include"),limit:b(this).data("limit"),display_stock:b(this).data("display_stock")}},processResults:function(i){var h=[];if(i){b.each(i,function(k,j){h.push({id:k,text:j})})}return{results:h}},cache:true}};g=b.extend(g,a());b(this).selectWoo(g).addClass("enhanced");if(b(this).data("sortable")){var f=b(this);var e=b(this).next(".select2-container").find("ul.select2-selection__rendered");e.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){b(e.find(".select2-selection__choice").get().reverse()).each(function(){var i=b(this).data("data").id;var h=f.find('option[value="'+i+'"]')[0];f.prepend(h)})}})}else{if(b(this).prop("multiple")){b(this).on("change",function(){var h=b(this).children();h.sort(function(j,i){var l=j.text.toLowerCase();var k=i.text.toLowerCase();if(l>k){return 1}if(l<k){return -1}return 0});b(this).html(h)})}}})});b(".wooccm-enhanced-search").filter(":not(.enhanced)").each(function(){var d={allowClear:b(this).data("allow_clear")?true:false,placeholder:b(this).data("placeholder"),minimumInputLength:b(this).data("minimum_input_length")||"3",escapeMarkup:function(e){return e},ajax:{url:wooccm_admin.ajax_url,dataType:"json",cache:true,delay:250,data:function(e){return{term:e.term,key:b(this).data("key"),action:"wooccm_search_field",nonce:wooccm_admin.nonce,}},processResults:function(f,g){var e=[];if(f){b.each(f,function(i,h){e.push({id:i,text:h})})}return{results:e}}}};d=b.extend(d,a());b(this).select2(d).addClass("enhanced")})})(jQuery);
assets/frontend/css/wooccm.css CHANGED
@@ -1,3 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  .woocommerce form .wooccm-clearfix:before,
2
  .woocommerce form .wooccm-clearfix:after {
3
  content: '';
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: '';
assets/frontend/css/wooccm.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../less/wooccm.less"],"names":[],"mappings":"AAGM,YAFJ,KACE,iBACG;AACC,YAHN,KACE,iBAEK;EACD,SAAQ,EAAR;EACA,cAAA;;AAEF,YAPJ,KACE,iBAMG;EACC,WAAA;;AATR,YACE,KAYE;EACE,aAAA;;AAdN,YACE,KAgBE,mBAEE,2BAEE;EACE,qBAAA;;AAtBV,YACE,KA2BE,yBACE;EACE,aAAA;;AAGF,YAhCJ,KA2BE,yBAKG,OACC;EACE,cAAA;;AASR,OAAC;EACC,kBAAA;EACA,0BAAA;;AAFF,OAAC,iBAIC;EACE,kBAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,YAAW,kBAAX;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAMN;EACE,cAAA;EACA,UAAA;EACA,aAAA;EACA,eAAA;EACA,mBAAA;EACA,sBAAA;;AANF,iBAQE;EACE,aAAA;EACA,uBAAA;EACA,oBAAA;EACA,sBAAA;EACA,uBAAA;EACA,UAAA;EAEA,kBAAA;;AAhBJ,iBAQE,kBAWE;EACE,UAAA;EACA,kBAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;EACA,kBAAA;EACA,cAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;EACA,eAAA;EACA,iBAAA;EACA,+BAAA;;AApCN,iBAQE,kBA+BE;EACE,WAAA;EACA,gBAAA;;AAzCN,iBAQE,kBAoCE;EACE,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,gBAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;EACA,gBAAA;;AApDN,iBAQE,kBAoCE,kCAUE;EACE,gBAAA;EACA,iBAAA;EACA,kBAAA;EACA,QAAA;EACA,YAAA;EACA,WAAA;EACA,YAAA;;AAEA,iBAvDN,kBAoCE,kCAUE,MASG;EACC,MAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EAEA,gBAAA;EACA,YAAA;EACA,WAAA","file":"wooccm.css"}
1
+ {"version":3,"sources":["../../less/wooccm.less"],"names":[],"mappings":"AAAA,YACE;;;;;;;;;;;;;;;;;AAEI,YAFJ,KACE,iBACG;AACC,YAHN,KACE,iBAEK;EACD,SAAQ,EAAR;EACA,cAAA;;AAEF,YAPJ,KACE,iBAMG;EACC,WAAA;;AATR,YACE,KAYE;EACE,aAAA;;AAdN,YACE,KAgBE,mBAEE,2BAEE;EACE,qBAAA;;AAtBV,YACE,KA2BE,yBACE;EACE,aAAA;;AAGF,YAhCJ,KA2BE,yBAKG,OACC;EACE,cAAA;;AAwBR,OAAC;EACC,kBAAA;EACA,0BAAA;;AAFF,OAAC,iBAIC;EACE,kBAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,UAAA;EACA,YAAW,kBAAX;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAMN;EACE,cAAA;EACA,UAAA;EACA,aAAA;EACA,eAAA;EACA,mBAAA;EACA,sBAAA;;AANF,iBAQE;EACE,aAAA;EACA,uBAAA;EACA,oBAAA;EACA,sBAAA;EACA,uBAAA;EACA,UAAA;EAEA,kBAAA;;AAhBJ,iBAQE,kBAWE;EACE,UAAA;EACA,kBAAA;EACA,QAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;EACA,kBAAA;EACA,cAAA;EACA,gBAAA;EACA,kBAAA;EACA,eAAA;EACA,eAAA;EACA,iBAAA;EACA,+BAAA;;AApCN,iBAQE,kBA+BE;EACE,WAAA;EACA,gBAAA;;AAzCN,iBAQE,kBAoCE;EACE,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,gBAAA;EACA,WAAA;EACA,iBAAA;EACA,kBAAA;EACA,gBAAA;;AApDN,iBAQE,kBAoCE,kCAUE;EACE,gBAAA;EACA,iBAAA;EACA,kBAAA;EACA,QAAA;EACA,YAAA;EACA,WAAA;EACA,YAAA;;AAEA,iBAvDN,kBAoCE,kCAUE,MASG;EACC,MAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EAEA,gBAAA;EACA,YAAA;EACA,WAAA","file":"wooccm.css"}
assets/frontend/css/wooccm.min.css CHANGED
@@ -1,2 +1,2 @@
1
 
2
- .wooccm-clearfix:before,.wooccm-clearfix:after{content:'';display:table}.wooccm-clearfix:after{clear:both}.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}.wooccmupload_list{margin:0 -5px;padding:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:start}.wooccmupload_list .wooccmupload_file{display:flex;justify-content:center;align-items:stretch;box-sizing:border-box;padding:10px 5px 0 5px;width:25%;max-height:90px;position:relative}.wooccmupload_list .wooccmupload_file .wooccmupload_file_delete{position:absolute;top:2px;right:-3px;width:16px;height:16px;background-color:#222;display:block;line-height:13px;text-align:center;color:#fefefe;font-weight:900;border-radius:50%;font-size:14px;cursor:pointer}.wooccmupload_list .wooccmupload_file .wooccmupload_file_container{width:100%;overflow:hidden}
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%}
includes/class-wooccm-notices.php CHANGED
@@ -81,7 +81,7 @@ class WOOCCM_Notices {
81
  </div>
82
  </div>
83
  <?php
84
- } elseif (!get_user_meta(get_current_user_id(), 'wooccm-user-rating', true) && !get_transient('wooccm-first-rating')) {
85
  ?>
86
  <div id="wooccm-admin-rating" class="wooccm-notice notice is-dismissible" data-notice_id="wooccm-user-rating">
87
  <div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
81
  </div>
82
  </div>
83
  <?php
84
+ } elseif (!get_user_meta(get_current_user_id(), 'wooccm-user-rating', true) && !get_transient('wooccm-first-rating') && !get_option('wccs_settings')) {
85
  ?>
86
  <div id="wooccm-admin-rating" class="wooccm-notice notice is-dismissible" data-notice_id="wooccm-user-rating">
87
  <div class="notice-container" style="padding-top: 10px; padding-bottom: 10px; display: flex; justify-content: left; align-items: center;">
includes/controller/class-wooccm-field.php CHANGED
@@ -279,6 +279,7 @@ class WOOCCM_Field_Controller {
279
  // fix unchecked checkboxes
280
  $field_data = wp_parse_args($field_data, WOOCCM()->$section->get_args());
281
 
 
282
  unset($field_data['order']);
283
  unset($field_data['required']);
284
  unset($field_data['position']);
279
  // fix unchecked checkboxes
280
  $field_data = wp_parse_args($field_data, WOOCCM()->$section->get_args());
281
 
282
+ // don't override
283
  unset($field_data['order']);
284
  unset($field_data['required']);
285
  unset($field_data['position']);
includes/model/class-wooccm-field.php CHANGED
@@ -135,7 +135,8 @@ class WOOCCM_Field {
135
  'add_price_total' => 0,
136
  'add_price_type' => 'fixed',
137
  'add_price_tax' => 0,
138
- 'default' => ''
 
139
  )
140
  ),
141
  'required' => false,
@@ -152,6 +153,7 @@ class WOOCCM_Field {
152
  'hide_account' => false,
153
  'hide_checkout' => false,
154
  'hide_email' => false,
 
155
  // Timing
156
  // -------------------------------------------------------------------
157
  'time_limit_start' => null,
@@ -273,6 +275,10 @@ class WOOCCM_Field {
273
  }
274
  }
275
 
 
 
 
 
276
  return wp_unslash($field);
277
  }
278
 
@@ -377,12 +383,10 @@ class WOOCCM_Field {
377
  public function get_field($field_id) {
378
 
379
  if ($fields = $this->get_fields()) {
380
-
381
- if (array_key_exists($field_id, $fields)) {
382
-
383
- $field = $fields[$field_id];
384
-
385
- return $this->sanitize_field($field_id, $field, $fields);
386
  }
387
  }
388
  }
@@ -391,7 +395,7 @@ class WOOCCM_Field {
391
 
392
  $fields = $this->get_fields();
393
 
394
- if (array_key_exists($field_id, $fields)) {
395
 
396
  $field_data = $this->sanitize_field_data($field_data);
397
 
135
  'add_price_total' => 0,
136
  'add_price_type' => 'fixed',
137
  'add_price_tax' => 0,
138
+ 'default' => '',
139
+ 'order' => 0
140
  )
141
  ),
142
  'required' => false,
153
  'hide_account' => false,
154
  'hide_checkout' => false,
155
  'hide_email' => false,
156
+ 'hide_order' => false,
157
  // Timing
158
  // -------------------------------------------------------------------
159
  'time_limit_start' => null,
275
  }
276
  }
277
 
278
+ if (count($field['options']) > 1) {
279
+ uasort($field['options'], array(__CLASS__, 'order_fields'));
280
+ }
281
+
282
  return wp_unslash($field);
283
  }
284
 
383
  public function get_field($field_id) {
384
 
385
  if ($fields = $this->get_fields()) {
386
+ if (isset($fields[$field_id])) {
387
+ return $fields[$field_id];
388
+ // $field = $fields[$field_id];
389
+ // return $this->sanitize_field($field_id, $field, $fields);
 
 
390
  }
391
  }
392
  }
395
 
396
  $fields = $this->get_fields();
397
 
398
+ if (isset($fields[$field_id])) {
399
 
400
  $field_data = $this->sanitize_field_data($field_data);
401
 
includes/view/backend/pages/modals/parts/panel-datepicker-limit.php CHANGED
@@ -1,17 +1,15 @@
1
  <# if ( data.date_limit == 'variable' ) { #>
2
- <div class="options_group wooccm-premium">
3
- <p class="form-field">
4
- <label><?php esc_html_e('Days before', 'woocommerce-checkout-manager'); ?></label>
5
- <input class="short" type="number" placeholder="3" min="0" max="365" name="date_limit_variable_min" value="{{data.date_limit_variable_min}}">
6
- <span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
7
- </p>
8
- <p class="form-field">
9
- <label><?php esc_html_e('Days after', 'woocommerce-checkout-manager'); ?></label>
10
- <input class="short" type="number" placeholder="3" min="0" max="365" name="date_limit_variable_max" value="{{data.date_limit_variable_max}}">
11
  <span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
12
  </p>
13
  </div>
14
- <# } else if ( data.date_limit == 'fixed' ) { #>
15
  <div class="options_group wooccm-premium wooccm-enhanced-between-dates">
16
  <p class="form-field dimensions_field">
17
  <label for="product_length"><?php esc_html_e('Between dates', 'woocommerce-checkout-manager'); ?></label>
1
  <# if ( data.date_limit == 'variable' ) { #>
2
+ <div class="options_group wooccm-premium wooccm-enhanced-between-days">
3
+ <p class="form-field dimensions_field">
4
+ <label for="product_length"><?php esc_html_e('Between days', 'woocommerce-checkout-manager'); ?></label>
5
+ <span class="wrap">
6
+ <input style="width:48.1%" type="number" placeholder="-3" min="-365" max="365" class="short " name="date_limit_variable_min" value="{{data.date_limit_variable_min}}">
7
+ <input style="width:48.1%;margin: 0;" type="number" placeholder="3" min="-365" max="365" class="short" name="date_limit_variable_max" value="{{data.date_limit_variable_max}}">
8
+ </span>
 
 
9
  <span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
10
  </p>
11
  </div>
12
+ <# } else { #>
13
  <div class="options_group wooccm-premium wooccm-enhanced-between-dates">
14
  <p class="form-field dimensions_field">
15
  <label for="product_length"><?php esc_html_e('Between dates', 'woocommerce-checkout-manager'); ?></label>
includes/view/backend/pages/modals/parts/panel-display.php CHANGED
@@ -87,5 +87,11 @@
87
  <span class="description hidden" style="display: inline-block"><?php esc_html_e('Hide this field on the user email', 'woocommerce-checkout-manager'); ?></span>
88
  <span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
89
  </p>
 
 
 
 
 
 
90
  </div>
91
  </div>
87
  <span class="description hidden" style="display: inline-block"><?php esc_html_e('Hide this field on the user email', 'woocommerce-checkout-manager'); ?></span>
88
  <span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
89
  </p>
90
+ <p class="form-field">
91
+ <label><?php esc_html_e('Hide on orders', 'woocommerce-checkout-manager'); ?></label>
92
+ <input <# if (data.hide_checkout) { #>checked="checked"<# } #> type="checkbox" name="hide_order" value="1">
93
+ <span class="description hidden" style="display: inline-block"><?php esc_html_e('Hide this field on the user order', 'woocommerce-checkout-manager'); ?></span>
94
+ <span class="description premium">(<?php esc_html_e('This is a premium feature', 'woocommerce-checkout-manager'); ?>)</span>
95
+ </p>
96
  </div>
97
  </div>
includes/view/backend/pages/modals/parts/panel-options.php CHANGED
@@ -26,7 +26,7 @@
26
  </tr>
27
  </thead>
28
  <tbody class="ui-sortable">
29
- <# _.each(data.options, function (option, index) { #>
30
  <tr class="row">
31
  <td class="check-column">
32
  <input class="check" type="checkbox" <# if(index === 0) { #>disabled="disabled"<# } #>/>
@@ -51,9 +51,9 @@
51
  <input value="{{index}}" type="radio" name="default" <# if (data.default == index) { #>checked="checked"<# } #> />
52
  <# } #>
53
  </td>
54
- <td class="sort reorder">
55
  <div class="wc-item-reorder-nav">
56
- <input type="hidden" name="option_order[]" value="{{index}}">
57
  </div>
58
  </td>
59
  </tr>
26
  </tr>
27
  </thead>
28
  <tbody class="ui-sortable">
29
+ <# _.each(_.sortOptions(data.options), function (option, index) { #>
30
  <tr class="row">
31
  <td class="check-column">
32
  <input class="check" type="checkbox" <# if(index === 0) { #>disabled="disabled"<# } #>/>
51
  <input value="{{index}}" type="radio" name="default" <# if (data.default == index) { #>checked="checked"<# } #> />
52
  <# } #>
53
  </td>
54
+ <td class="sort ui-sortable-handle">
55
  <div class="wc-item-reorder-nav">
56
+ <input value="{{option.order}}" style="width: 50px" class="add-order" type="hidden" name="options[{{index}}][order]"/>
57
  </div>
58
  </td>
59
  </tr>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://quadlayers.com/
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 4.6
6
  Tested up to: 5.3.0
7
- Stable tag: 4.8.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -99,6 +99,9 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
99
 
100
  == Changelog ==
101
 
 
 
 
102
  = 4.8.0 =
103
  * Fix: woocommerce checkout datepicker field disabled days
104
  * Fix: woocommerce checkout datepicker label scape quotes
4
  Tags: woocommerce, woocommerce checkout, field manager, checkout editor, checkout field, shipping field, billing field, order field, additional field
5
  Requires at least: 4.6
6
  Tested up to: 5.3.0
7
+ Stable tag: 4.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
99
 
100
  == Changelog ==
101
 
102
+ = 4.8.1 =
103
+ * Fix: woocommerce checkout reorder field options
104
+
105
  = 4.8.0 =
106
  * Fix: woocommerce checkout datepicker field disabled days
107
  * Fix: woocommerce checkout datepicker label scape quotes
templates/order/order-custom-fields.php CHANGED
@@ -7,7 +7,7 @@
7
  foreach ($fields as $key => $field) :
8
  if (isset(WOOCCM()->$field_type)) :
9
  ?>
10
- <?php if (!in_array($field['name'], WOOCCM()->$field_type->get_defaults())) : ?>
11
  <?php if ($value = get_post_meta($order_id, sprintf('_%s', $key), true)): ?>
12
  <tr id="tr-<?php echo esc_attr($key); ?>">
13
  <th>
7
  foreach ($fields as $key => $field) :
8
  if (isset(WOOCCM()->$field_type)) :
9
  ?>
10
+ <?php if (!in_array($field['name'], WOOCCM()->$field_type->get_defaults()) && empty($field['hide_order'])) : ?>
11
  <?php if ($value = get_post_meta($order_id, sprintf('_%s', $key), true)): ?>
12
  <tr id="tr-<?php echo esc_attr($key); ?>">
13
  <th>
woocommerce-checkout-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
- * Version: 4.8.0
7
  * Author: QuadLayers
8
  * Author URI: https://www.quadlayers.com
9
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
@@ -17,7 +17,7 @@ if (!defined('WOOCCM_PLUGIN_NAME')) {
17
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
18
  }
19
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
20
- define('WOOCCM_PLUGIN_VERSION', '4.8.0');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);
3
  /**
4
  * Plugin Name: WooCommerce Checkout Manager
5
  * Description: Manages WooCommerce Checkout, the advanced way.
6
+ * Version: 4.8.1
7
  * Author: QuadLayers
8
  * Author URI: https://www.quadlayers.com
9
  * Copyright: 2019 QuadLayers (https://www.quadlayers.com)
17
  define('WOOCCM_PLUGIN_NAME', 'WooCommerce Checkout Manager');
18
  }
19
  if (!defined('WOOCCM_PLUGIN_VERSION')) {
20
+ define('WOOCCM_PLUGIN_VERSION', '4.8.1');
21
  }
22
  if (!defined('WOOCCM_PLUGIN_FILE')) {
23
  define('WOOCCM_PLUGIN_FILE', __FILE__);