WooCommerce Checkout Manager - Version 6.2.7

Version Description

Download this release

Release Info

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

Code changes from version 6.2.6 to 6.2.7

assets/backend/css/admin.css DELETED
@@ -1 +0,0 @@
1
- .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:0.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:none;box-shadow:none}table.wooccm-enhanced-options>thead>th .woocommerce-help-tip{margin:-1px 0 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:#ffffff;z-index:99999999;opacity:0.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 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:none}#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/admin-field.asset.php DELETED
@@ -1 +0,0 @@
1
- <?php return array('dependencies' => array('backbone', 'jquery', 'jquery-ui-datepicker', 'wp-util'), 'version' => '0815485febc8e317b67dcc102b05f0c1');
 
assets/backend/js/admin-field.js DELETED
@@ -1 +0,0 @@
1
- !function(e){var t={};function o(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)o.d(n,a,function(t){return e[t]}.bind(null,a));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(1),o(2),o(3),o(4);!function(e){var t,o=0,n=function(){e("#wooccm_modal").removeClass("processing")};_.mixin({sortOptions:function(e){return _.sortBy(e,(function(e){return e.order}))},escapeHtml:function(e){return e.replace("&amp;",/&/g).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&#039;/g,"'")},getFormData:function(e){var t=e.serializeJSON({checkboxUncheckedValue:"false",parseBooleans:!0,parseNulls:!0}),o=Object.assign({},wooccm_field.args);return Object.assign(o,t)}});var a=Backbone.Model.extend({defaults:Object.create(wooccm_field.args)}),i=Backbone.View.extend({initialize:function(t){var o=e(t.target).closest("[data-field_id]").data("field_id"),n=new a;n.set({id:o}),new l({model:n}).render()}}),l=Backbone.View.extend({events:{"change input":"enableSave","change textarea":"enableSave","change select":"enableSave","click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","click .media-modal-tab":"tab","change .media-modal-parent":"parent","change .media-modal-render-tabs":"renderTabs","change .media-modal-render-panels":"renderPanels","change .media-modal-render-info":"renderInfo","submit .media-modal-form":"submit"},templates:{},initialize:function(){_.bindAll(this,"open","tab","edit","load","render","close","submit","parent"),this.init(),this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-main")},assign:function(e,t){e.setElement(this.$(t)).render()},updateModel:function(e){e&&e.preventDefault();var t=this.$el.find("#wooccm_modal").find("form"),o=_.getFormData(t);this.model.set(o)},reload:function(e){this.$el.find("#wooccm_modal").hasClass("reload")?location.reload():this.remove()},close:function(t){t.preventDefault(),this.undelegateEvents(),e(document).off("focusin"),e("body").removeClass("modal-open"),this.$el.find("#wooccm_modal").addClass("reload"),this.reload(t)},enableSave:function(t){e(".media-modal-submit").prop("disabled",!1),this.updateModel(t)},disableSave:function(t){e(".media-modal-submit").prop("disabled",!0)},tab:function(t){t.preventDefault();var o=this.$el.find("#wooccm_modal"),n=e(t.currentTarget),a=o.find("ul.wc-tabs"),i=n.find("a").attr("href").replace("#","");a.find(".active").removeClass("active"),n.addClass("active"),this.model.attributes.panel=i,this.model.changed.panel=i,this.renderPanels(t)},renderTabs:function(e){this.renderPanels(e),this.tabs.render()},renderPanels:function(e){this.updateModel(e),this.panels.render()},render:function(){this.$el.html(this.templates.window(this.model.attributes)),this.tabs=new c({model:this.model}),this.panels=new d({model:this.model}),this.info=new s({model:this.model}),this.assign(this.tabs,"#wooccm-modal-tabs"),this.assign(this.panels,"#wooccm-modal-panels"),this.assign(this.info,"#wooccm-modal-info")},open:function(t){e("body").addClass("modal-open").append(this.$el),null!=this.model.attributes.id?this.load():_.delay((function(){n()}),100)},load:function(){var t=this;null!=t.model.attributes.id?e.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",complete:function(){n()},error:function(){alert("Error!")},success:function(e){console.log("response",e),e.success?(t.model.set(e.data),t.render()):alert(e.data)}}):t.render()},edit:function(n){n.preventDefault();var a=this,i=e(n.target),l=parseInt(e(".wc_gateways tr[data-field_id]").length),c=parseInt(a.model.get("order"));o++,t&&clearTimeout(t),t=setTimeout((function(){c=i.hasClass("media-modal-next")?Math.min(c+o,l):Math.max(c-o,1),a.model.set({id:parseInt(e(".wc_gateways tr[data-field_order="+c+"]").data("field_id"))}),o=0,a.load()}),300)},submit:function(t){t.preventDefault();var o=this,n=o.$el.find("#wooccm_modal"),a=n.find(".settings-save-status .spinner"),i=n.find(".settings-save-status .saved");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_data:JSON.stringify(o.model.attributes)},dataType:"json",type:"POST",beforeSend:function(){e(".media-modal-submit").prop("disabled",!0),a.addClass("is-active")},complete:function(){i.addClass("is-active"),a.removeClass("is-active"),_.delay((function(){i.removeClass("is-active")}),1e3)},error:function(e){alert("Error!")},success:function(e){e.success?null==o.model.attributes.id&&(n.addClass("reload"),o.reload(t),o.close(t)):alert(e.data)}}),!1},renderInfo:function(){this.info.render()},parent:function(t){t.preventDefault();var o=this,n=o.$el.find("#wooccm_modal").find(".attachment-details");return this.updateModel(t),e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_parent",nonce:wooccm_field.nonce,conditional_parent_key:o.model.attributes.conditional_parent_key},dataType:"json",type:"POST",beforeSend:function(){o.disableSave(),n.addClass("save-waiting")},complete:function(){n.addClass("save-complete"),n.removeClass("save-waiting"),o.enableSave()},error:function(){alert("Error!")},success:function(e){e.success?(o.model.attributes.parent=e.data,o.model.changed.parent=e.data,o.renderInfo()):alert(e.data)}}),!1}}),c=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-tabs")},render:function(){this.model.attributes.panel="general",this.$el.html(this.templates.window(this.model.attributes))}}),d=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")}}),s=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")}});e("#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",(function(e){e.preventDefault(),new i(e)})),e("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",(function(t){t.preventDefault();e(t.target);return!!confirm(wooccm_field.message.reset)&&(e.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(e){e.success?location.reload():alert(e.data)}}),!1)})),e(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",(function(e){e.preventDefault(),new i(e)})),e(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",(function(t){t.preventDefault();var o=e(t.target).closest("[data-field_id]"),n=o.data("field_id");return!!confirm(wooccm_field.message.remove)&&(e.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(e){e.success?o.remove():alert(e.data)}}),!1)})),e(document).on("click",".wooccm-field-toggle-attribute",(function(t){t.preventDefault();var o=e(this),n=o.closest("tr"),a=o.find(".woocommerce-input-toggle");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:e(this).data("field_attr"),field_id:n.data("field_id")},dataType:"json",type:"POST",beforeSend:function(e){a.addClass("woocommerce-input-toggle--loading")},success:function(e){!0===e.data?(a.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled"),a.addClass("woocommerce-input-toggle--enabled"),a.removeClass("woocommerce-input-toggle--loading")):!0!==e.data&&(a.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled"),a.addClass("woocommerce-input-toggle--disabled"),a.removeClass("woocommerce-input-toggle--loading"))}}),!1})),e(document).on("change",".wooccm-field-change-attribute",(function(t){t.preventDefault();var o=e(this),n=o.closest("tr");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_change_field_attribute",nonce:wooccm_field.nonce,field_attr:o.data("field_attr"),field_value:o.val(),field_id:n.data("field_id")},dataType:"json",type:"POST",beforeSend:function(e){o.prop("disabled",!0)},success:function(e){console.log(e.data)},complete:function(e){o.prop("disabled",!1)}}),!1}))}(jQuery)},function(e,t){!function(){e.exports=this.jQuery}()},function(e,t){!function(){e.exports=this.wp.util}()},function(e,t){!function(){e.exports=this.window.Backbone}()},function(e,t){!function(){e.exports=this.window.uiDatepicker}()}]);
 
assets/backend/js/admin.asset.php DELETED
@@ -1 +0,0 @@
1
- <?php return array('dependencies' => array('jquery', 'jquery-serializejson'), 'version' => 'f389cc2bea7176abd765911bfcb7c116');
 
assets/backend/js/admin.js DELETED
@@ -1 +0,0 @@
1
- !function(e){var t={};function n(a){if(t[a])return t[a].exports;var c=t[a]={i:a,l:!1,exports:{}};return e[a].call(c.exports,c,c.exports,n),c.l=!0,c.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(a,c,function(t){return e[t]}.bind(null,c));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){!function(){e.exports=this.jQuery}()},function(e,t,n){"use strict";n.r(t);var a=n(0),c=n.n(a);n(3),n(2);function i(e){var t=c()(e).next().is(".hasDatepicker")?"minDate":"maxDate",n="minDate"===t?c()(e).next():c()(e).prev(),a=c()(e).datepicker("getDate");c()(n).datepicker("option",t,a),c()(e).change()}function o(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}c()(".wooccm-premium-field").closest("tr").addClass("wooccm-premium"),c()(document).on("wooccm-enhanced-between-dates",(function(e){c()(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each((function(){c()(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,onSelect:function(){i(c()(this))}}),c()(this).find("input").each((function(){i(c()(this))}))}))})),c()(document).on("wooccm-enhanced-options",(function(e){c()("table.wc_gateways tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,t){return t.children().each((function(){c()(this).width(c()(this).width())})),t.css("left","0"),t},start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style"),t.item.trigger("updateMoveButtons")},update:function(e,t){c()(this).find("tr").each((function(e,t){c()(t).find("input.add-order").val(e).trigger("change")}))}}),c()(".wooccm-enhanced-options").each((function(){var e=c()(this),t=e.find(".add-option"),n=e.find(".remove-options");t.on("click",(function(t){var a=e.find("tbody > tr"),i=a.length,o=a.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+i+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+i+'"').replace('<input value="0"','<input value="'+i+'"');a.last().after(c()("<tr>"+o+"</tr>")).find("input").trigger("change"),n.removeProp("disabled")})),n.on("click",(function(t){e.find("tr > td.check-column input:checked").closest("tr").remove();var n=e.find("tbody > tr");n.first().find("input").trigger("change"),n.length<2&&c()(this).prop("disabled",!0)}))}))})),c()(document).on("wooccm-enhanced-select",(function(e){c()(".wooccm-enhanced-select").filter(":not(.enhanced)").each((function(){var e=c.a.extend({minimumResultsForSearch:10,allowClear:!!c()(this).data("allow_clear"),placeholder:c()(this).data("placeholder")},o());c()(this).attr("name");c()(this).selectWoo(e).addClass("enhanced")})),c()(".wooccm-product-search").filter(":not(.enhanced)").each((function(){var e={allowClear:!!c()(this).data("allow_clear"),placeholder:c()(this).data("placeholder"),minimumInputLength:c()(this).data("minimum_input_length")?c()(this).data("minimum_input_length"):"3",escapeMarkup:function(e){return e},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(e){return{term:e.term,action:c()(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:c()(this).select2("val")||0,exclude:c()(this).data("exclude"),include:c()(this).data("include"),limit:c()(this).data("limit"),display_stock:c()(this).data("display_stock")}},processResults:function(e){var t=[];return e&&c.a.each(e,(function(e,n){t.push({id:e,text:n})})),{results:t}},cache:!0}};e=c.a.extend(e,o());c()(this).attr("name");if(c()(this).selectWoo(e).addClass("enhanced"),c()(this).data("sortable")){var t=c()(this),n=c()(this).next(".select2-container").find("ul.select2-selection__rendered");n.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){c()(n.find(".select2-selection__choice").get().reverse()).each((function(){var e=c()(this).data("data").id,n=t.find('option[value="'+e+'"]')[0];t.prepend(n)}))}})}else c()(this).prop("multiple")&&c()(this).on("change",(function(){var e=c()(this).children();e.filter("option").sort((function(e,t){var n=e.text.toLowerCase(),a=t.text.toLowerCase();return n>a?1:n<a?-1:0})),c()(this).html(e)}))}))})),c()(".wooccm-enhanced-search").filter(":not(.enhanced)").each((function(){var e={allowClear:!!c()(this).data("allow_clear"),placeholder:c()(this).data("placeholder"),minimumInputLength:c()(this).data("minimum_input_length")||"3",escapeMarkup:function(e){return e},ajax:{url:wooccm_admin.ajax_url,dataType:"json",cache:!0,delay:250,data:function(e){return{term:e.term,key:c()(this).data("key"),action:"wooccm_search_field",nonce:wooccm_admin.nonce}},processResults:function(e,t){var n=[];return e&&c.a.each(e,(function(e,t){n.push({id:e,text:t})})),{results:n}}}};e=c.a.extend(e,o()),c()(this).select2(e).addClass("enhanced")}))},function(e,t){!function(){e.exports=this.window.serializeJSON}()},function(e,t){}]);
 
assets/frontend/js/checkout.js DELETED
@@ -1 +0,0 @@
1
- !function(e){var t={};function o(i){if(t[i])return t[i].exports;var c=t[i]={i:i,l:!1,exports:{}};return e[i].call(c.exports,c,c.exports,o),c.l=!0,c.exports}o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)o.d(i,c,function(t){return e[t]}.bind(null,c));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(3),o(1),o(2);!function(e){var t=function(e){return e.is(".processing")||e.parents(".processing").length};e(document).on("country_to_state_changing",(function(t,o,i){var c=i,n=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(n,(function(e,t){var o=c.find(t),i=o.find("[data-required]").data("required")||o.find(".wooccm-required-field").length;!function(e,t){t?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),e.show(),e.find("input[type=hidden]").prop("type","text")):(e.find("label .required").remove(),e.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===e.find("label .optional").length&&e.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}(o,i)}))}));var o={};if(e(".wooccm-type-file").each((function(t,i){var c=e(i),n=c.find("[type=file]"),a=c.find(".wooccm-file-button"),r=c.find(".wooccm-file-list");o[c.attr("id")]=[],a.on("click",(function(e){e.preventDefault(),n.trigger("click")})),r.on("click",".wooccm-file-list-delete",(function(t){var i=e(this).closest(".wooccm-file-file"),n=e(this).closest("[data-file_id]").data("file_id");o[c.attr("id")]=e.grep(o[c.attr("id")],(function(e,t){return t!=n})),i.remove(),e("#order_review").trigger("wooccm_upload")})),n.on("change",(function(t){var i=e(this)[0].files;i.length&&window.FileReader&&e.each(i,(function(t,i){if(r.find("span[data-file_id]").length+t>=wooccm_upload.limit.max_files)return alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1;if(i.size>wooccm_upload.limit.max_file_size)return alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0;var n,a=new FileReader;a.onload=(n=i,function(t){setTimeout((function(){!function(t,o,i,c,n){var a,r=e(t);n.match("image.*")?a="image":n.match("application/ms.*")?(i=wooccm_upload.icons.spreadsheet,a="spreadsheet"):n.match("application/x.*")?(i=wooccm_upload.icons.archive,a="application"):n.match("audio.*")?(i=wooccm_upload.icons.audio,a="audio"):n.match("text.*")?(i=wooccm_upload.icons.text,a="text"):n.match("video.*")?(i=wooccm_upload.icons.video,a="video"):(i=wooccm_upload.icons.interactive,a="interactive");var l='<span data-file_id="'+o+'" title="'+c+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+c+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+a+'" alt="'+c+'" src="'+i+'"/>\n </span>\n </span>\n </span>';r.append(l).fadeIn()}(r,o[c.attr("id")].push(i)-1,t.target.result,n.name,n.type),e("#order_review").trigger("wooccm_upload")}),200)}),a.readAsDataURL(i)}))}))})),e("#order_review").on("ajaxSuccess wooccm_upload",(function(t,o,i){var c=e(t.target).find("#place_order");e(".wooccm-type-file").length?c.addClass("wooccm-upload-process"):c.removeClass("wooccm-upload-process")})),e(document).on("click","#place_order.wooccm-upload-process",(function(i){i.preventDefault();var c,n=e("form.checkout"),a=e(this);e(".wooccm-type-file").length&&(window.FormData&&Object.keys(o).length&&(t(n)||(a.html(wooccm_upload.message.uploading),t(c=n)||c.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,(function(t,o){var i=e("#"+t).find(".wooccm-file-field"),c=new FormData;e.each(o,(function(e,t){return e>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):t.size>wooccm_upload.limit.max_file_size?(console.log("Exeeds max file size of "+wooccm_upload.limit.max_files),!0):(console.log("We're ready to upload "+t.name),void c.append("wooccm_checkout_attachment_upload[]",t))})),c.append("action","wooccm_checkout_attachment_upload"),c.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:c,processData:!1,contentType:!1,beforeSend:function(e){},success:function(t){t.success?i.val(t.data):e("body").trigger("update_checkout")},complete:function(e){}})})),function(e){e.removeClass("processing").unblock()}(n),a.removeClass("wooccm-upload-process").trigger("click")))})),e(document).on("change",".wooccm-add-price",(function(t){e("body").trigger("update_checkout")})),e(".wooccm-field").each((function(t,o){e(o).find("input,textarea,select").on("change keyup wooccm_change",(function(t){var o=e(t.target).attr("name").replace("[]",""),i=e(t.target).prop("type"),c=e(t.target).val();"checkbox"==i&&(c=-1!==e(t.target).attr("name").indexOf("[]")?e(t.target).closest(".wooccm-field").find("input:checked").map((function(e,t){return t.value})).toArray():e(t.target).is(":checked")),e("*[data-conditional-parent="+o+"]").closest(".wooccm-field").hide(),e("*[data-conditional-parent="+o+"]").each((function(t,o){var i=e(o),n=i&&i.data("conditional-parent-value");(c==n||e.isArray(c)&&c.indexOf(n)>-1)&&i.closest(".wooccm-field").attr("style","display: block !important")}))}))})),e(".wooccm-conditional-child").each((function(t,o){var i=e(o),c=e("#"+i.find("[data-conditional-parent]").data("conditional-parent")+"_field");c.find("select:first").trigger("wooccm_change"),c.find("textarea:first").trigger("wooccm_change"),c.find("input[type=button]:first").trigger("wooccm_change"),c.find("input[type=radio]:checked:first").trigger("wooccm_change"),c.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),c.find("input[type=color]:first").trigger("wooccm_change"),c.find("input[type=date]:first").trigger("wooccm_change"),c.find("input[type=datetime-local]:first").trigger("wooccm_change"),c.find("input[type=email]:first").trigger("wooccm_change"),c.find("input[type=file]:first").trigger("wooccm_change"),c.find("input[type=hidden]:first").trigger("wooccm_change"),c.find("input[type=image]:first").trigger("wooccm_change"),c.find("input[type=month]:first").trigger("wooccm_change"),c.find("input[type=number]:first").trigger("wooccm_change"),c.find("input[type=password]:first").trigger("wooccm_change"),c.find("input[type=range]:first").trigger("wooccm_change"),c.find("input[type=reset]:first").trigger("wooccm_change"),c.find("input[type=search]:first").trigger("wooccm_change"),c.find("input[type=submit]:first").trigger("wooccm_change"),c.find("input[type=tel]:first").trigger("wooccm_change"),c.find("input[type=text]:first").trigger("wooccm_change"),c.find("input[type=time]:first").trigger("wooccm_change"),c.find("input[type=url]:first").trigger("wooccm_change"),c.find("input[type=week]:first").trigger("wooccm_change")})),e(".wooccm-enhanced-datepicker").each((function(t,o){var i=e(this),c=i.data("disable")||!1;e.isFunction(e.fn.datepicker)&&i.datepicker({dateFormat:i.data("formatdate")||"mm/dd/yy",minDate:i.data("mindate"),maxDate:i.data("maxdate"),beforeShowDay:function(t){var o=null!=t.getDay()&&t.getDay().toString();return c?[-1===e.inArray(o,c)]:[!0]}})})),e(".wooccm-enhanced-timepicker").each((function(t,o){var i=e(this);e.isFunction(e.fn.timepicker)&&(console.log(i.data("format-ampm")),i.timepicker({showPeriodLabels:!!i.data("format-ampm"),showPeriod:!!i.data("format-ampm"),showLeadingZero:!0,hours:i.data("hours")||void 0,minutes:i.data("minutes")||void 0}))})),e(".wooccm-colorpicker-farbtastic").each((function(t,o){var i=e(o),c=i.find("input[type=text]"),n=i.find(".wooccmcolorpicker_container");c.hide(),e.isFunction(e.fn.farbtastic)&&(n.farbtastic("#"+c.attr("id")),n.on("click",(function(e){c.fadeIn()})))})),e(".wooccm-colorpicker-iris").each((function(t,o){var i=e(o),c=i.find("input[type=text]");c.css("background",c.val()),c.on("click",(function(e){i.toggleClass("active")})),c.iris({class:c.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){c.css("background",t.color.toString()).fadeIn()}})})),e(document).on("click",(function(t){0===e(t.target).closest(".iris-picker").length&&e(".wooccm-colorpicker-iris").removeClass("active")})),"undefined"==typeof wc_country_select_params)return!1;if(e().selectWoo){e("select.wooccm-enhanced-select").each((function(){var t=e.extend({width:"100%",placeholder:e(this).data("placeholder")||"",allowClear:e(this).data("allowclear")||!1,selectOnClose:e(this).data("selectonclose")||!1,closeOnSelect:e(this).data("closeonselect")||!1,minimumResultsForSearch:e(this).data("search")||-1},{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}});e(this).on("select2:select",(function(){e(this).focus()})).selectWoo(t)}))}}(jQuery)},function(e,t){!function(){e.exports=this.jQuery}()},function(e,t){!function(){e.exports=this.window.selectWoo}()},function(e,t){}]);
 
assets/frontend/js/order-upload.asset.php DELETED
@@ -1 +0,0 @@
1
- <?php return array('dependencies' => array('jquery'), 'version' => '21579d17fba223671216029a4af5bd89');
 
assets/frontend/js/order-upload.js DELETED
@@ -1 +0,0 @@
1
- !function(e){var t={};function o(a){if(t[a])return t[a].exports;var c=t[a]={i:a,l:!1,exports:{}};return e[a].call(c.exports,c,c.exports,o),c.l=!0,c.exports}o.m=e,o.c=t,o.d=function(e,t,a){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)o.d(a,c,function(t){return e[t]}.bind(null,c));return a},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";o.r(t);o(1);jQuery(document).ready((function(e){e(document).on("click",".wooccm_delete_attachment",(function(t){var o=e(this).closest("tr"),a=e(this).data("attachment_id");o.hide(),e("#wooccm_order_attachment_update").prop("disabled",!1),e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(a,""))})),e(document).on("click","#wooccm_order_attachment_update",(function(t){e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:{action:"wooccm_order_attachment_update",nonce:wooccm_upload.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(t){e(".wooccm_upload_results").html(wooccm_upload.message.saving)},success:function(t){t.success?(e(".wooccm_upload_results").html(wooccm_upload.message.deleted),e("#wooccm_order_attachment_update").prop("disabled",!0)):e(".wooccm_upload_results").html(t.data)}})})),e(document).on("change","#wooccm_order_attachment_upload",(function(t){var o=!1,a=e(this).data("order_id");window.FormData&&(o=new FormData);for(var c,n=0,r=this.files.length;n<r;n++)c=this.files[n],o&&o.append("wooccm_order_attachment_upload[]",c);o&&(o.append("action","wooccm_order_attachment_upload"),o.append("nonce",wooccm_upload.nonce),o.append("order_id",a),e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:o,processData:!1,contentType:!1,beforeSend:function(t){var o;e(".wooccm_upload_results").html(wooccm_upload.message.uploading),function(e){return e.is(".processing")||e.parents(".processing").length}(o=e(".wooccm_order_attachments_wrapper"))||o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},success:function(t){t.success?(e(".wooccm_order_attachments_wrapper").fadeOut(),e(".wooccm_order_attachments_wrapper").replaceWith(e(t.data).fadeIn()),e(".wooccm_upload_results").html(wooccm_upload.message.success)):e(".wooccm_upload_results").html(t.data),e(".wooccm_order_attachments_wrapper").removeClass("processing").unblock()}}))}))}))},function(e,t){!function(){e.exports=this.jQuery}()}]);
 
build/backend/css/style.css ADDED
@@ -0,0 +1 @@
 
1
+ .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:none;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,.8) !important;outline:2px solid rgba(0,0,0,0) !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:none}#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}
build/backend/js/index.asset.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php return array('dependencies' => array('backbone', 'jquery', 'jquery-serializejson', 'jquery-ui-datepicker', 'wp-util'), 'version' => 'f67e0ed96ee9b0e5e761');
build/backend/js/index.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";var e={n:function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,{a:n}),n},d:function(t,n){for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.jQuery,n=e.n(t);function a(e){var t=n()(e).next().is(".hasDatepicker")?"minDate":"maxDate",a="minDate"===t?n()(e).next():n()(e).prev(),o=n()(e).datepicker("getDate");n()(a).datepicker("option",t,o),n()(e).change()}function o(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}window.window.serializeJSON,n()(".wooccm-premium-field").closest("tr").addClass("wooccm-premium"),n()(document).on("wooccm-enhanced-between-dates",(function(e){n()(".wooccm-enhanced-between-dates").filter(":not(.enhanced)").each((function(){n()(this).find("input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,onSelect:function(){a(n()(this))}}),n()(this).find("input").each((function(){a(n()(this))}))}))})),n()(document).on("wooccm-enhanced-options",(function(e){n()("table.wc_gateways tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,t){return t.children().each((function(){n()(this).width(n()(this).width())})),t.css("left","0"),t},start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style"),t.item.trigger("updateMoveButtons")},update:function(e,t){n()(this).find("tr").each((function(e,t){n()(t).find("input.add-order").val(e).trigger("change")}))}}),n()(".wooccm-enhanced-options").each((function(){var e=n()(this),t=e.find(".add-option"),a=e.find(".remove-options");t.on("click",(function(t){var o=e.find("tbody > tr"),i=o.length,c=o.first().clone().html().replace(/options\[([0-9]+)\]/g,"options["+i+"]").replace('disabled="disabled"',"").replace('checked="checked"',"").replace('<input value="0"','<input value="'+i+'"').replace('<input value="0"','<input value="'+i+'"');o.last().after(n()("<tr>"+c+"</tr>")).find("input").trigger("change"),a.removeProp("disabled")})),a.on("click",(function(t){e.find("tr > td.check-column input:checked").closest("tr").remove();var a=e.find("tbody > tr");a.first().find("input").trigger("change"),a.length<2&&n()(this).prop("disabled",!0)}))}))})),n()(document).on("wooccm-enhanced-select",(function(e){n()(".wooccm-enhanced-select").filter(":not(.enhanced)").each((function(){var e=n().extend({minimumResultsForSearch:10,allowClear:!!n()(this).data("allow_clear"),placeholder:n()(this).data("placeholder")},o());n()(this).attr("name"),n()(this).selectWoo(e).addClass("enhanced")})),n()(".wooccm-product-search").filter(":not(.enhanced)").each((function(){var e={allowClear:!!n()(this).data("allow_clear"),placeholder:n()(this).data("placeholder"),minimumInputLength:n()(this).data("minimum_input_length")?n()(this).data("minimum_input_length"):"3",escapeMarkup:function(e){return e},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(e){return{term:e.term,action:n()(this).data("action")||"wooccm_select_search_products",security:wc_enhanced_select_params.search_products_nonce,selected:n()(this).select2("val")||0,exclude:n()(this).data("exclude"),include:n()(this).data("include"),limit:n()(this).data("limit"),display_stock:n()(this).data("display_stock")}},processResults:function(e){var t=[];return e&&n().each(e,(function(e,n){t.push({id:e,text:n})})),{results:t}},cache:!0}};if(e=n().extend(e,o()),n()(this).attr("name"),n()(this).selectWoo(e).addClass("enhanced"),n()(this).data("sortable")){var t=n()(this),a=n()(this).next(".select2-container").find("ul.select2-selection__rendered");a.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){n()(a.find(".select2-selection__choice").get().reverse()).each((function(){var e=n()(this).data("data").id,a=t.find('option[value="'+e+'"]')[0];t.prepend(a)}))}})}else n()(this).prop("multiple")&&n()(this).on("change",(function(){var e=n()(this).children();e.filter("option").sort((function(e,t){var n=e.text.toLowerCase(),a=t.text.toLowerCase();return n>a?1:n<a?-1:0})),n()(this).html(e)}))}))})),n()(".wooccm-enhanced-search").filter(":not(.enhanced)").each((function(){var e={allowClear:!!n()(this).data("allow_clear"),placeholder:n()(this).data("placeholder"),minimumInputLength:n()(this).data("minimum_input_length")||"3",escapeMarkup:function(e){return e},ajax:{url:wooccm_admin.ajax_url,dataType:"json",cache:!0,delay:250,data:function(e){return{term:e.term,key:n()(this).data("key"),action:"wooccm_search_field",nonce:wooccm_admin.nonce}},processResults:function(e,t){var a=[];return e&&n().each(e,(function(e,t){a.push({id:e,text:t})})),{results:a}}}};e=n().extend(e,o()),n()(this).select2(e).addClass("enhanced")})),window.wp.util,window.window.Backbone,window.window.uiDatepicker,function(e){var t,n=0,a=function(){e("#wooccm_modal").removeClass("processing")};_.mixin({sortOptions:function(e){return _.sortBy(e,(function(e){return e.order}))},escapeHtml:function(e){return e.replace("&amp;",/&/g).replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&quot;/g,'"').replace(/&#039;/g,"'")},getFormData:function(e){let t=e.serializeJSON({checkboxUncheckedValue:"false",parseBooleans:!0,parseNulls:!0}),n=Object.assign({},wooccm_field.args);return Object.assign(n,t)}});var o=Backbone.Model.extend({defaults:Object.create(wooccm_field.args)}),i=Backbone.View.extend({initialize:function(t){var n=e(t.target).closest("[data-field_id]").data("field_id"),a=new o;a.set({id:n}),new c({model:a}).render()}}),c=Backbone.View.extend({events:{"change input":"enableSave","change textarea":"enableSave","change select":"enableSave","click .media-modal-backdrop":"close","click .media-modal-close":"close","click .media-modal-prev":"edit","click .media-modal-next":"edit","click .media-modal-tab":"tab","change .media-modal-parent":"parent","change .media-modal-render-tabs":"renderTabs","change .media-modal-render-panels":"renderPanels","change .media-modal-render-info":"renderInfo","submit .media-modal-form":"submit"},templates:{},initialize:function(){_.bindAll(this,"open","tab","edit","load","render","close","submit","parent"),this.init(),this.open()},init:function(){this.templates.window=wp.template("wooccm-modal-main")},assign:function(e,t){e.setElement(this.$(t)).render()},updateModel:function(e){e&&e.preventDefault();var t=this.$el.find("#wooccm_modal").find("form"),n=_.getFormData(t);this.model.set(n)},reload:function(e){this.$el.find("#wooccm_modal").hasClass("reload")?location.reload():this.remove()},close:function(t){t.preventDefault(),this.undelegateEvents(),e(document).off("focusin"),e("body").removeClass("modal-open"),this.$el.find("#wooccm_modal").addClass("reload"),this.reload(t)},enableSave:function(t){e(".media-modal-submit").prop("disabled",!1),this.updateModel(t)},disableSave:function(t){e(".media-modal-submit").prop("disabled",!0)},tab:function(t){t.preventDefault();var n=this.$el.find("#wooccm_modal"),a=e(t.currentTarget),o=n.find("ul.wc-tabs"),i=a.find("a").attr("href").replace("#","");o.find(".active").removeClass("active"),a.addClass("active"),this.model.attributes.panel=i,this.model.changed.panel=i,this.renderPanels(t)},renderTabs:function(e){this.renderPanels(e),this.tabs.render()},renderPanels:function(e){this.updateModel(e),this.panels.render()},render:function(){var e=this;e.$el.html(e.templates.window(e.model.attributes)),this.tabs=new l({model:e.model}),this.panels=new s({model:e.model}),this.info=new d({model:e.model}),this.assign(this.tabs,"#wooccm-modal-tabs"),this.assign(this.panels,"#wooccm-modal-panels"),this.assign(this.info,"#wooccm-modal-info")},open:function(t){e("body").addClass("modal-open").append(this.$el),null!=this.model.attributes.id?this.load():_.delay((function(){a()}),100)},load:function(){var t=this;null!=t.model.attributes.id?e.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",complete:function(){a()},error:function(){alert("Error!")},success:function(e){console.log("response",e),e.success?(t.model.set(e.data),t.render()):alert(e.data)}}):t.render()},edit:function(a){a.preventDefault();var o=this,i=e(a.target),c=parseInt(e(".wc_gateways tr[data-field_id]").length),l=parseInt(o.model.get("order"));n++,t&&clearTimeout(t),t=setTimeout((function(){l=i.hasClass("media-modal-next")?Math.min(l+n,c):Math.max(l-n,1),o.model.set({id:parseInt(e(".wc_gateways tr[data-field_order="+l+"]").data("field_id"))}),n=0,o.load()}),300)},submit:function(t){t.preventDefault();var n=this,a=n.$el.find("#wooccm_modal"),o=a.find(".settings-save-status .spinner"),i=a.find(".settings-save-status .saved");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_save_field",nonce:wooccm_field.nonce,field_data:JSON.stringify(n.model.attributes)},dataType:"json",type:"POST",beforeSend:function(){e(".media-modal-submit").prop("disabled",!0),o.addClass("is-active")},complete:function(){i.addClass("is-active"),o.removeClass("is-active"),_.delay((function(){i.removeClass("is-active")}),1e3)},error:function(e){alert("Error!")},success:function(e){e.success?null==n.model.attributes.id&&(a.addClass("reload"),n.reload(t),n.close(t)):alert(e.data)}}),!1},renderInfo:function(){this.info.render()},parent:function(t){t.preventDefault();var n=this,a=n.$el.find("#wooccm_modal").find(".attachment-details");return this.updateModel(t),e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_load_parent",nonce:wooccm_field.nonce,conditional_parent_key:n.model.attributes.conditional_parent_key},dataType:"json",type:"POST",beforeSend:function(){n.disableSave(),a.addClass("save-waiting")},complete:function(){a.addClass("save-complete"),a.removeClass("save-waiting"),n.enableSave()},error:function(){alert("Error!")},success:function(e){e.success?(n.model.attributes.parent=e.data,n.model.changed.parent=e.data,n.renderInfo()):alert(e.data)}}),!1}}),l=Backbone.View.extend({templates:{},initialize:function(){this.templates.window=wp.template("wooccm-modal-tabs")},render:function(){this.model.attributes.panel="general",this.$el.html(this.templates.window(this.model.attributes))}}),s=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")}}),d=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")}});e("#wooccm_billing_settings_add, #wooccm_shipping_settings_add, #wooccm_additional_settings_add").on("click",(function(e){e.preventDefault(),new i(e)})),e("#wooccm_billing_settings_reset, #wooccm_shipping_settings_reset, #wooccm_additional_settings_reset").on("click",(function(t){return t.preventDefault(),e(t.target),!!confirm(wooccm_field.message.reset)&&(e.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(e){e.success?location.reload():alert(e.data)}}),!1)})),e(".wooccm_billing_settings_edit, .wooccm_shipping_settings_edit, .wooccm_additional_settings_edit").on("click",(function(e){e.preventDefault(),new i(e)})),e(".wooccm_billing_settings_delete, .wooccm_shipping_settings_delete, .wooccm_additional_settings_delete").on("click",(function(t){t.preventDefault();var n=e(t.target).closest("[data-field_id]"),a=n.data("field_id");return!!confirm(wooccm_field.message.remove)&&(e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_delete_field",nonce:wooccm_field.nonce,field_id:a},dataType:"json",type:"POST",beforeSend:function(){},complete:function(){},error:function(){alert("Error!")},success:function(e){e.success?n.remove():alert(e.data)}}),!1)})),e(document).on("click",".wooccm-field-toggle-attribute",(function(t){t.preventDefault();var n=e(this),a=n.closest("tr"),o=n.find(".woocommerce-input-toggle");return e.ajax({url:wooccm_field.ajax_url,data:{action:"wooccm_toggle_field_attribute",nonce:wooccm_field.nonce,field_attr:e(this).data("field_attr"),field_id:a.data("field_id")},dataType:"json",type:"POST",beforeSend:function(e){o.addClass("woocommerce-input-toggle--loading")},success:function(e){!0===e.data?(o.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled"),o.addClass("woocommerce-input-toggle--enabled"),o.removeClass("woocommerce-input-toggle--loading")):!0!==e.data&&(o.removeClass("woocommerce-input-toggle--enabled, woocommerce-input-toggle--disabled"),o.addClass("woocommerce-input-toggle--disabled"),o.removeClass("woocommerce-input-toggle--loading"))}}),!1})),e(document).on("change",".wooccm-field-change-attribute",(function(t){t.preventDefault();var n=e(this),a=n.closest("tr");return e.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:a.data("field_id")},dataType:"json",type:"POST",beforeSend:function(e){n.prop("disabled",!0)},success:function(e){console.log(e.data)},complete:function(e){n.prop("disabled",!1)}}),!1}))}(jQuery)}();
assets/frontend/css/checkout.css → build/frontend/css/style.css RENAMED
@@ -1 +1 @@
1
- .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 !important}.woocommerce form .wooccm-type-hidden{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}.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:0.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%;max-height:100%;height:100%;width:100%}.wooccm-file-list .ui-timepicker-table a{word-break:normal}.wooccm-file-list .ui-state-disabled,.wooccm-file-list .ui-widget-content .ui-state-disabled,.wooccm-file-list .ui-widget-header .ui-state-disabled{width:100%}
1
+ .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 !important}.woocommerce form .wooccm-type-hidden{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}.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%;max-height:100%;height:100%;width:100%}.wooccm-file-list .ui-timepicker-table a{word-break:normal}.wooccm-file-list .ui-state-disabled,.wooccm-file-list .ui-widget-content .ui-state-disabled,.wooccm-file-list .ui-widget-header .ui-state-disabled{width:100%}
assets/frontend/js/checkout.asset.php → build/frontend/js/index.asset.php RENAMED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => 'd965767de0d000d90ae9a4a9ab4908af');
1
+ <?php return array('dependencies' => array('jquery', 'selectWoo'), 'version' => '748451c5d01520c8446c');
build/frontend/js/index.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){"use strict";window.jQuery,jQuery(document).ready((function(e){e(document).on("click",".wooccm_delete_attachment",(function(t){var o=e(this).closest("tr"),c=e(this).data("attachment_id");o.hide(),e("#wooccm_order_attachment_update").prop("disabled",!1),e("#delete_attachments_ids").val(e("#delete_attachments_ids").val().replace(c,""))})),e(document).on("click","#wooccm_order_attachment_update",(function(t){e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:{action:"wooccm_order_attachment_update",nonce:wooccm_upload.nonce,delete_attachments_ids:e("#delete_attachments_ids").val(),all_attachments_ids:e("#all_attachments_ids").val()},beforeSend:function(t){e(".wooccm_upload_results").html(wooccm_upload.message.saving)},success:function(t){t.success?(e(".wooccm_upload_results").html(wooccm_upload.message.deleted),e("#wooccm_order_attachment_update").prop("disabled",!0)):e(".wooccm_upload_results").html(t.data)}})})),e(document).on("change","#wooccm_order_attachment_upload",(function(t){var o=!1,c=e(this).data("order_id");window.FormData&&(o=new FormData);for(var a,n=0,i=this.files.length;n<i;n++)a=this.files[n],o&&o.append("wooccm_order_attachment_upload[]",a);o&&(o.append("action","wooccm_order_attachment_upload"),o.append("nonce",wooccm_upload.nonce),o.append("order_id",c),e.ajax({url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:o,processData:!1,contentType:!1,beforeSend:function(t){var o;e(".wooccm_upload_results").html(wooccm_upload.message.uploading),function(e){return e.is(".processing")||e.parents(".processing").length}(o=e(".wooccm_order_attachments_wrapper"))||o.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},success:function(t){t.success?(e(".wooccm_order_attachments_wrapper").fadeOut(),e(".wooccm_order_attachments_wrapper").replaceWith(e(t.data).fadeIn()),e(".wooccm_upload_results").html(wooccm_upload.message.success)):e(".wooccm_upload_results").html(t.data),e(".wooccm_order_attachments_wrapper").removeClass("processing").unblock()}}))}))})),window.window.selectWoo,function(e){var t=function(e){return e.is(".processing")||e.parents(".processing").length};e(document).on("country_to_state_changing",(function(t,o,c){var a=c,n=e.parseJSON(wc_address_i18n_params.locale_fields);e.each(n,(function(e,t){var o=a.find(t),c=o.find("[data-required]").data("required")||o.find(".wooccm-required-field").length;!function(e,t){t?(e.find("label .optional").remove(),e.addClass("validate-required"),0===e.find("label .required").length&&e.find("label").append('<abbr class="required" title="'+wc_address_i18n_params.i18n_required_text+'">*</abbr>'),e.show(),e.find("input[type=hidden]").prop("type","text")):(e.find("label .required").remove(),e.removeClass("validate-required woocommerce-invalid woocommerce-invalid-required-field"),0===e.find("label .optional").length&&e.find("label").append('<span class="optional">('+wc_address_i18n_params.i18n_optional_text+")</span>"))}(o,c)}))}));var o={};if(e(".wooccm-type-file").each((function(t,c){var a=e(c),n=a.find("[type=file]"),i=a.find(".wooccm-file-button"),r=a.find(".wooccm-file-list");o[a.attr("id")]=[],i.on("click",(function(e){e.preventDefault(),alert("Test!!"),n.trigger("click")})),r.on("click",".wooccm-file-list-delete",(function(t){var c=e(this).closest(".wooccm-file-file"),n=e(this).closest("[data-file_id]").data("file_id");o[a.attr("id")]=e.grep(o[a.attr("id")],(function(e,t){return t!=n})),c.remove(),e("#order_review").trigger("wooccm_upload")})),n.on("change",(function(t){var c=e(this)[0].files;c.length&&window.FileReader&&e.each(c,(function(t,c){if(r.find("span[data-file_id]").length+t>=wooccm_upload.limit.max_files)return alert("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1;if(c.size>wooccm_upload.limit.max_file_size)return alert("Exeeds max file size of "+wooccm_upload.limit.max_file_size),!0;var n,i=new FileReader;i.onload=(n=c,function(t){setTimeout((function(){!function(t,o,c,a,n){var i,r=e(t);n.match("image.*")?i="image":n.match("application/ms.*")?(c=wooccm_upload.icons.spreadsheet,i="spreadsheet"):n.match("application/x.*")?(c=wooccm_upload.icons.archive,i="application"):n.match("audio.*")?(c=wooccm_upload.icons.audio,i="audio"):n.match("text.*")?(c=wooccm_upload.icons.text,i="text"):n.match("video.*")?(c=wooccm_upload.icons.video,i="video"):(c=wooccm_upload.icons.interactive,i="interactive");var s='<span data-file_id="'+o+'" title="'+a+'" class="wooccm-file-file">\n <span class="wooccm-file-list-container">\n <a title="'+a+'" class="wooccm-file-list-delete">×</a>\n <span class="wooccm-file-list-image-container">\n <img class="'+i+'" alt="'+a+'" src="'+c+'"/>\n </span>\n </span>\n </span>';r.append(s).fadeIn()}(r,o[a.attr("id")].push(c)-1,t.target.result,n.name,n.type),e("#order_review").trigger("wooccm_upload")}),200)}),i.readAsDataURL(c)}))}))})),e("#order_review").on("ajaxSuccess wooccm_upload",(function(t,o,c){e(t.target);var a=e("#place_order");e(".wooccm-type-file").length?a.addClass("wooccm-upload-process"):a.removeClass("wooccm-upload-process")})),e(document).on("click","#place_order.wooccm-upload-process",(function(c){c.preventDefault();var a,n=e("form.checkout"),i=e(this);e(".wooccm-type-file").length&&window.FormData&&Object.keys(o).length&&(t(n)||(i.html(wooccm_upload.message.uploading),t(a=n)||a.addClass("processing").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})),e.each(o,(function(t,o){var c=e("#"+t).find(".wooccm-file-field"),a=new FormData;e.each(o,(function(e,t){return e>wooccm_upload.limit.max_files?(console.log("Exeeds max files limit of "+wooccm_upload.limit.max_files),!1):t.size>wooccm_upload.limit.max_file_size?(console.log("Exeeds max file size of "+wooccm_upload.limit.max_files),!0):(console.log("We're ready to upload "+t.name),void a.append("wooccm_checkout_attachment_upload[]",t))})),a.append("action","wooccm_checkout_attachment_upload"),a.append("nonce",wooccm_upload.nonce),e.ajax({async:!1,url:wooccm_upload.ajax_url,type:"POST",cache:!1,data:a,processData:!1,contentType:!1,beforeSend:function(e){},success:function(t){t.success?c.val(t.data):e("body").trigger("update_checkout")},complete:function(e){}})})),function(e){e.removeClass("processing").unblock()}(n),i.removeClass("wooccm-upload-process").trigger("click"))})),e(document).on("change",".wooccm-add-price",(function(t){e("body").trigger("update_checkout")})),e(".wooccm-field").each((function(t,o){e(o).find("input,textarea,select").on("change keyup wooccm_change",(function(t){var o=e(t.target).attr("name").replace("[]",""),c=e(t.target).prop("type"),a=e(t.target).val();"checkbox"==c&&(a=-1!==e(t.target).attr("name").indexOf("[]")?e(t.target).closest(".wooccm-field").find("input:checked").map((function(e,t){return t.value})).toArray():e(t.target).is(":checked")),e("*[data-conditional-parent="+o+"]").closest(".wooccm-field").hide(),e("*[data-conditional-parent="+o+"]").each((function(t,o){var c=e(o),n=c&&c.data("conditional-parent-value");(a==n||e.isArray(a)&&a.indexOf(n)>-1)&&c.closest(".wooccm-field").attr("style","display: block !important")}))}))})),e(".wooccm-conditional-child").each((function(t,o){var c=e(o),a=e("#"+c.find("[data-conditional-parent]").data("conditional-parent")+"_field");a.find("select:first").trigger("wooccm_change"),a.find("textarea:first").trigger("wooccm_change"),a.find("input[type=button]:first").trigger("wooccm_change"),a.find("input[type=radio]:checked:first").trigger("wooccm_change"),a.find("input[type=checkbox]:checked:first").trigger("wooccm_change"),a.find("input[type=color]:first").trigger("wooccm_change"),a.find("input[type=date]:first").trigger("wooccm_change"),a.find("input[type=datetime-local]:first").trigger("wooccm_change"),a.find("input[type=email]:first").trigger("wooccm_change"),a.find("input[type=file]:first").trigger("wooccm_change"),a.find("input[type=hidden]:first").trigger("wooccm_change"),a.find("input[type=image]:first").trigger("wooccm_change"),a.find("input[type=month]:first").trigger("wooccm_change"),a.find("input[type=number]:first").trigger("wooccm_change"),a.find("input[type=password]:first").trigger("wooccm_change"),a.find("input[type=range]:first").trigger("wooccm_change"),a.find("input[type=reset]:first").trigger("wooccm_change"),a.find("input[type=search]:first").trigger("wooccm_change"),a.find("input[type=submit]:first").trigger("wooccm_change"),a.find("input[type=tel]:first").trigger("wooccm_change"),a.find("input[type=text]:first").trigger("wooccm_change"),a.find("input[type=time]:first").trigger("wooccm_change"),a.find("input[type=url]:first").trigger("wooccm_change"),a.find("input[type=week]:first").trigger("wooccm_change")})),e(".wooccm-enhanced-datepicker").each((function(t,o){var c=e(this),a=c.data("disable")||!1;e.isFunction(e.fn.datepicker)&&c.datepicker({dateFormat:c.data("formatdate")||"mm/dd/yy",minDate:c.data("mindate"),maxDate:c.data("maxdate"),beforeShowDay:function(t){var o=null!=t.getDay()&&t.getDay().toString();return a?[-1===e.inArray(o,a)]:[!0]}})})),e(".wooccm-enhanced-timepicker").each((function(t,o){var c=e(this);e.isFunction(e.fn.timepicker)&&(console.log(c.data("format-ampm")),c.timepicker({showPeriodLabels:!!c.data("format-ampm"),showPeriod:!!c.data("format-ampm"),showLeadingZero:!0,hours:c.data("hours")||void 0,minutes:c.data("minutes")||void 0}))})),e(".wooccm-colorpicker-farbtastic").each((function(t,o){var c=e(o),a=c.find("input[type=text]"),n=c.find(".wooccmcolorpicker_container");a.hide(),e.isFunction(e.fn.farbtastic)&&(n.farbtastic("#"+a.attr("id")),n.on("click",(function(e){a.fadeIn()})))})),e(".wooccm-colorpicker-iris").each((function(t,o){var c=e(o),a=c.find("input[type=text]");a.css("background",a.val()),a.on("click",(function(e){c.toggleClass("active")})),a.iris({class:a.attr("id"),palettes:!0,color:"",hide:!1,change:function(e,t){a.css("background",t.color.toString()).fadeIn()}})})),e(document).on("click",(function(t){0===e(t.target).closest(".iris-picker").length&&e(".wooccm-colorpicker-iris").removeClass("active")})),"undefined"==typeof wc_country_select_params)return!1;e().selectWoo&&e("select.wooccm-enhanced-select").each((function(){var t=e.extend({width:"100%",placeholder:e(this).data("placeholder")||"",allowClear:e(this).data("allowclear")||!1,selectOnClose:e(this).data("selectonclose")||!1,closeOnSelect:e(this).data("closeonselect")||!1,minimumResultsForSearch:e(this).data("search")||-1},{language:{errorLoading:function(){return wc_country_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wc_country_select_params.i18n_input_too_long_1:wc_country_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wc_country_select_params.i18n_input_too_short_1:wc_country_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wc_country_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_country_select_params.i18n_selection_too_long_1:wc_country_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_country_select_params.i18n_no_matches},searching:function(){return wc_country_select_params.i18n_searching}}});e(this).on("select2:select",(function(){e(this).focus()})).selectWoo(t)}))}(jQuery)}();
includes/class-wooccm-backend.php CHANGED
@@ -1,108 +1,104 @@
1
  <?php
2
 
3
- class WOOCCM_Field_Admin
4
- {
5
 
6
- protected static $_instance;
7
 
8
- public function __construct()
9
- {
10
 
11
- add_action('wp_ajax_wooccm_select_search_products', array($this, 'ajax_select_search_products'));
12
- add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
13
- add_action('admin_menu', array($this, 'add_menu_page'));
14
- add_filter('woocommerce_settings_tabs_array', array($this, 'add_tab'), 50);
15
- }
 
16
 
17
- public static function instance()
18
- {
19
- if (is_null(self::$_instance)) {
20
- self::$_instance = new self();
21
- }
22
- return self::$_instance;
23
- }
24
 
25
- public function ajax_select_search_products()
26
- {
27
 
28
- if (current_user_can('manage_woocommerce') && check_ajax_referer('search-products', 'security') && isset($_REQUEST['term'])) {
 
 
29
 
30
- if (empty($term) && isset($_GET['term'])) {
31
- $term = (string) wc_clean(wp_unslash($_GET['term']));
32
- }
33
 
34
- if (empty($term)) {
35
- wp_die();
36
- }
 
 
37
 
38
- if (!empty($_GET['limit'])) {
39
- $limit = absint($_GET['limit']);
40
- } else {
41
- $limit = absint(apply_filters('woocommerce_json_search_limit', 30));
42
- }
43
 
44
- $include_ids = !empty($_GET['include']) ? array_map('absint', (array) wp_unslash($_GET['include'])) : array();
45
- $exclude_ids = !empty($_GET['exclude']) ? array_map('absint', (array) wp_unslash($_GET['exclude'])) : array();
46
- $selected_ids = !empty($_GET['selected']) ? array_map('absint', (array) wp_unslash($_GET['selected'])) : array();
47
 
48
- $include_variations = false;
 
49
 
50
- $data_store = WC_Data_Store::load('product');
51
- $ids = $data_store->search_products($term, '', (bool) $include_variations, false, $limit, $include_ids, $exclude_ids + $selected_ids);
52
 
53
- $product_objects = array_filter(array_map('wc_get_product', $ids), 'wc_products_array_filter_readable');
54
- $products = array();
 
55
 
56
- foreach ($product_objects as $product_object) {
57
- $formatted_name = $product_object->get_formatted_name();
58
- $managing_stock = $product_object->managing_stock();
 
 
59
 
60
- if ($managing_stock && !empty($_GET['display_stock'])) {
61
- $stock_amount = $product_object->get_stock_quantity();
62
- /* Translators: %d stock amount */
63
- $formatted_name .= ' &ndash; ' . sprintf(esc_html__('Stock: %d', 'woocommerce'), wc_format_stock_quantity_for_display($stock_amount, $product_object));
64
- }
65
 
66
- $products[$product_object->get_id()] = rawurldecode($formatted_name);
67
- }
 
68
 
69
- wp_send_json(apply_filters('woocommerce_json_search_found_products', $products));
70
- }
71
- }
72
 
73
- public function enqueue_scripts()
74
- {
75
 
76
- $screen = get_current_screen();
77
 
78
- $admin = include_once(WOOCCM_PLUGIN_DIR . 'assets/backend/js/admin.asset.php');
79
 
80
- wp_register_style('wooccm-admin', plugins_url('assets/backend/css/admin.css', WOOCCM_PLUGIN_FILE), array(), WOOCCM_PLUGIN_VERSION, 'all');
81
 
82
- wp_register_script('jquery-serializejson', plugins_url('/assets/backend/jquery-serializejson/jquery-serializejson' . WOOCCM::is_min() . '.js', WOOCCM_PLUGIN_FILE), array('jquery'), WOOCCM_PLUGIN_VERSION, true);
 
 
 
 
 
 
 
 
 
 
 
83
 
84
- wp_register_script('wooccm-admin', plugins_url('/assets/backend/js/admin.js', WOOCCM_PLUGIN_FILE), $admin['dependencies'], $admin['version'], true);
85
 
86
- if ((isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) || in_array($screen->id, array(/* 'product', 'edit-product', */'shop_order', 'edit-shop_order'))) {
87
- wp_enqueue_style('wooccm-admin');
88
- wp_enqueue_script('wooccm-admin');
89
- wp_localize_script('wooccm-admin', 'wooccm_admin', array(
90
- 'ajax_url' => admin_url('admin-ajax.php'),
91
- 'nonce' => wp_create_nonce('wooccm_search_field'),
92
- ));
93
- }
94
- }
95
 
96
- public function add_tab($settings_tabs)
97
- {
98
- $settings_tabs[WOOCCM_PREFIX] = esc_html__('Checkout', 'woocommerce-checkout-manager');
99
- return $settings_tabs;
100
- }
101
-
102
- public function add_menu_page()
103
- {
104
- add_submenu_page('woocommerce', esc_html__('Checkout', 'woocommerce-checkout-manager'), esc_html__('Checkout', 'woocommerce-checkout-manager'), 'manage_woocommerce', admin_url('admin.php?page=wc-settings&tab=' . sanitize_title(WOOCCM_PREFIX)));
105
- }
106
  }
107
 
108
  WOOCCM_Field_Admin::instance();
1
  <?php
2
 
3
+ class WOOCCM_Field_Admin {
 
4
 
 
5
 
6
+ protected static $_instance;
 
7
 
8
+ public function __construct() {
9
+ add_action( 'wp_ajax_wooccm_select_search_products', array( $this, 'ajax_select_search_products' ) );
10
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
11
+ add_action( 'admin_menu', array( $this, 'add_menu_page' ) );
12
+ add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_tab' ), 50 );
13
+ }
14
 
15
+ public static function instance() {
16
+ if ( is_null( self::$_instance ) ) {
17
+ self::$_instance = new self();
18
+ }
19
+ return self::$_instance;
20
+ }
 
21
 
22
+ public function ajax_select_search_products() {
23
+ if ( current_user_can( 'manage_woocommerce' ) && check_ajax_referer( 'search-products', 'security' ) && isset( $_REQUEST['term'] ) ) {
24
 
25
+ if ( empty( $term ) && isset( $_GET['term'] ) ) {
26
+ $term = (string) wc_clean( wp_unslash( $_GET['term'] ) );
27
+ }
28
 
29
+ if ( empty( $term ) ) {
30
+ wp_die();
31
+ }
32
 
33
+ if ( ! empty( $_GET['limit'] ) ) {
34
+ $limit = absint( $_GET['limit'] );
35
+ } else {
36
+ $limit = absint( apply_filters( 'woocommerce_json_search_limit', 30 ) );
37
+ }
38
 
39
+ $include_ids = ! empty( $_GET['include'] ) ? array_map( 'absint', (array) wp_unslash( $_GET['include'] ) ) : array();
40
+ $exclude_ids = ! empty( $_GET['exclude'] ) ? array_map( 'absint', (array) wp_unslash( $_GET['exclude'] ) ) : array();
41
+ $selected_ids = ! empty( $_GET['selected'] ) ? array_map( 'absint', (array) wp_unslash( $_GET['selected'] ) ) : array();
 
 
42
 
43
+ $include_variations = false;
 
 
44
 
45
+ $data_store = WC_Data_Store::load( 'product' );
46
+ $ids = $data_store->search_products( $term, '', (bool) $include_variations, false, $limit, $include_ids, $exclude_ids + $selected_ids );
47
 
48
+ $product_objects = array_filter( array_map( 'wc_get_product', $ids ), 'wc_products_array_filter_readable' );
49
+ $products = array();
50
 
51
+ foreach ( $product_objects as $product_object ) {
52
+ $formatted_name = $product_object->get_formatted_name();
53
+ $managing_stock = $product_object->managing_stock();
54
 
55
+ if ( $managing_stock && ! empty( $_GET['display_stock'] ) ) {
56
+ $stock_amount = $product_object->get_stock_quantity();
57
+ /* Translators: %d stock amount */
58
+ $formatted_name .= ' &ndash; ' . sprintf( esc_html__( 'Stock: %d', 'woocommerce' ), wc_format_stock_quantity_for_display( $stock_amount, $product_object ) );
59
+ }
60
 
61
+ $products[ $product_object->get_id() ] = rawurldecode( $formatted_name );
62
+ }
 
 
 
63
 
64
+ wp_send_json( apply_filters( 'woocommerce_json_search_found_products', $products ) );
65
+ }
66
+ }
67
 
68
+ public function enqueue_scripts() {
69
+ $screen = get_current_screen();
 
70
 
71
+ $admin = include_once WOOCCM_PLUGIN_DIR . 'build/backend/js/index.asset.php';
 
72
 
73
+ wp_register_style( 'wooccm-admin-css', plugins_url( 'build/backend/css/style.css', WOOCCM_PLUGIN_FILE ), array(), WOOCCM_PLUGIN_VERSION, 'all' );
74
 
75
+ wp_register_script( 'jquery-serializejson', plugins_url( 'assets/backend/jquery-serializejson/jquery-serializejson' . WOOCCM::is_min() . '.js', WOOCCM_PLUGIN_FILE ), array( 'jquery' ), WOOCCM_PLUGIN_VERSION, true );
76
 
77
+ wp_register_script( 'wooccm-admin-js', plugins_url( 'build/backend/js/index.js', WOOCCM_PLUGIN_FILE ), $admin['dependencies'], $admin['version'], true );
78
 
79
+ if ( ( isset( $_GET['tab'] ) && $_GET['tab'] === WOOCCM_PREFIX ) || in_array( $screen->id, array( /* 'product', 'edit-product', */'shop_order', 'edit-shop_order' ) ) ) {
80
+ wp_enqueue_style( 'wooccm-admin-css' );
81
+ wp_enqueue_script( 'wooccm-admin-js' );
82
+ wp_localize_script(
83
+ 'wooccm-admin-js',
84
+ 'wooccm_admin',
85
+ array(
86
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
87
+ 'nonce' => wp_create_nonce( 'wooccm_search_field' ),
88
+ )
89
+ );
90
+ }
91
 
92
+ }
93
 
94
+ public function add_tab( $settings_tabs ) {
95
+ $settings_tabs[ WOOCCM_PREFIX ] = esc_html__( 'Checkout', 'woocommerce-checkout-manager' );
96
+ return $settings_tabs;
97
+ }
 
 
 
 
 
98
 
99
+ public function add_menu_page() {
100
+ add_submenu_page( 'woocommerce', esc_html__( 'Checkout', 'woocommerce-checkout-manager' ), esc_html__( 'Checkout', 'woocommerce-checkout-manager' ), 'manage_woocommerce', admin_url( 'admin.php?page=wc-settings&tab=' . sanitize_title( WOOCCM_PREFIX ) ) );
101
+ }
 
 
 
 
 
 
 
102
  }
103
 
104
  WOOCCM_Field_Admin::instance();
includes/class-wooccm.php CHANGED
@@ -45,14 +45,14 @@ final class WOOCCM {
45
  // Frontend
46
  // -----------------------------------------------------------------------
47
 
48
- $checkout = include WOOCCM_PLUGIN_DIR . 'assets/frontend/js/checkout.asset.php';
49
 
50
- wp_register_style( 'wooccm-checkout-css', plugins_url( 'assets/frontend/css/checkout.css', WOOCCM_PLUGIN_FILE ), false, WOOCCM_PLUGIN_VERSION, 'all' );
51
 
52
- wp_register_script( 'wooccm-checkout-js', plugins_url( 'assets/frontend/js/checkout.js', WOOCCM_PLUGIN_FILE ), $checkout['dependencies'], $checkout['version'], true );
53
 
54
  wp_localize_script(
55
- 'wooccm-checkout-js',
56
  'wooccm_upload',
57
  array(
58
  'ajax_url' => admin_url( 'admin-ajax.php' ),
@@ -62,6 +62,8 @@ final class WOOCCM {
62
  'max_files' => 4,
63
  // 'mime_types' => $this->get_mime_types(),
64
  ),
 
 
65
  'icons' => array(
66
  'interactive' => site_url( 'wp-includes/images/media/interactive.png' ),
67
  'spreadsheet' => site_url( 'wp-includes/images/media/spreadsheet.png' ),
@@ -97,36 +99,7 @@ final class WOOCCM {
97
  );
98
 
99
  wp_register_script( 'farbtastic', admin_url( 'js/farbtastic.js' ), array( 'jquery' ), $wp_version );
100
-
101
- // Admin
102
- // -------------------------------------------------------------------------
103
-
104
- $upload = include WOOCCM_PLUGIN_DIR . 'assets/frontend/js/order-upload.asset.php';
105
-
106
- wp_register_script( 'wooccm-order-upload', plugins_url( 'assets/frontend/js/order-upload.js', WOOCCM_PLUGIN_FILE ), $upload['dependencies'], $upload['version'], true );
107
-
108
- wp_localize_script(
109
- 'wooccm-order-upload',
110
- 'wooccm_upload',
111
- array(
112
- 'ajax_url' => admin_url( 'admin-ajax.php?metabox=' . is_admin() ),
113
- 'nonce' => wp_create_nonce( 'wooccm_upload' ),
114
- 'message' => array(
115
- 'uploading' => esc_html__( 'Uploading, please wait...', 'woocommerce-checkout-manager' ),
116
- 'saving' => esc_html__( 'Saving, please wait...', 'woocommerce-checkout-manager' ),
117
- 'success' => esc_html__( 'Files uploaded successfully.', 'woocommerce-checkout-manager' ),
118
- 'deleted' => esc_html__( 'Deleted successfully.', 'woocommerce-checkout-manager' ),
119
- ),
120
- 'icons' => array(
121
- 'interactive' => site_url( 'wp-includes/images/media/interactive.png' ),
122
- 'spreadsheet' => site_url( 'wp-includes/images/media/spreadsheet.png' ),
123
- 'archive' => site_url( 'wp-includes/images/media/archive.png' ),
124
- 'audio' => site_url( 'wp-includes/images/media/audio.png' ),
125
- 'text' => site_url( 'wp-includes/images/media/text.png' ),
126
- 'video' => site_url( 'wp-includes/images/media/video.png' ),
127
- ),
128
- )
129
- );
130
  }
131
 
132
  public function clear_session() {
45
  // Frontend
46
  // -----------------------------------------------------------------------
47
 
48
+ $frontend = include WOOCCM_PLUGIN_DIR . 'build/frontend/js/index.asset.php';
49
 
50
+ wp_register_style( 'wooccm-checkout-css', plugins_url( 'build/frontend/css/style.css', WOOCCM_PLUGIN_FILE ), false, WOOCCM_PLUGIN_VERSION, 'all' );
51
 
52
+ wp_register_script( 'wooccm-frontend-js', plugins_url( 'build/frontend/js/index.js', WOOCCM_PLUGIN_FILE ), $frontend['dependencies'], $frontend['version'], true );
53
 
54
  wp_localize_script(
55
+ 'wooccm-frontend-js',
56
  'wooccm_upload',
57
  array(
58
  'ajax_url' => admin_url( 'admin-ajax.php' ),
62
  'max_files' => 4,
63
  // 'mime_types' => $this->get_mime_types(),
64
  ),
65
+ // 'ajax_url' => admin_url( 'admin-ajax.php?metabox=' . is_admin() ),
66
+ // 'nonce' => wp_create_nonce( 'wooccm_upload' ),
67
  'icons' => array(
68
  'interactive' => site_url( 'wp-includes/images/media/interactive.png' ),
69
  'spreadsheet' => site_url( 'wp-includes/images/media/spreadsheet.png' ),
99
  );
100
 
101
  wp_register_script( 'farbtastic', admin_url( 'js/farbtastic.js' ), array( 'jquery' ), $wp_version );
102
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
104
 
105
  public function clear_session() {
includes/controller/class-wooccm-checkout.php CHANGED
@@ -71,7 +71,7 @@ class WOOCCM_Checkout_Controller {
71
 
72
  // Checkout
73
  // ---------------------------------------------------------------------
74
- wp_enqueue_script( 'wooccm-checkout-js' );
75
  }
76
  }
77
 
71
 
72
  // Checkout
73
  // ---------------------------------------------------------------------
74
+ wp_enqueue_script( 'wooccm-frontend-js' );
75
  }
76
  }
77
 
includes/controller/class-wooccm-field.php CHANGED
@@ -1,407 +1,381 @@
1
  <?php
2
 
3
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-controller.php');
4
-
5
- class WOOCCM_Field_Controller extends WOOCCM_Controller
6
- {
7
-
8
- protected static $_instance;
9
- public $billing;
10
-
11
- public function __construct()
12
- {
13
-
14
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-billing.php');
15
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-shipping.php');
16
- include_once(WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-additional.php');
17
- include_once(WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-i18n.php');
18
-
19
- if (!is_admin()) {
20
- include_once(WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-register.php');
21
- include_once(WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-additional.php');
22
- include_once(WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-disable.php');
23
- include_once(WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-conditional.php');
24
- include_once(WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-handler.php');
25
- include_once(WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-filters.php');
26
- }
27
-
28
- add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
29
- add_action('wp_ajax_wooccm_load_parent', array($this, 'ajax_load_parent'));
30
- add_action('wp_ajax_wooccm_load_field', array($this, 'ajax_load_field'));
31
- add_action('wp_ajax_wooccm_save_field', array($this, 'ajax_save_field'));
32
- add_action('wp_ajax_wooccm_delete_field', array($this, 'ajax_delete_field'));
33
- add_action('wp_ajax_wooccm_reset_fields', array($this, 'ajax_reset_fields'));
34
- add_action('wp_ajax_wooccm_change_field_attribute', array($this, 'ajax_change_field_attribute'));
35
- add_action('wp_ajax_wooccm_toggle_field_attribute', array($this, 'ajax_toggle_field_attribute'));
36
- add_action('woocommerce_settings_save_' . WOOCCM_PREFIX, array($this, 'save_field_order'));
37
- }
38
-
39
- public static function instance()
40
- {
41
- if (is_null(self::$_instance)) {
42
- self::$_instance = new self();
43
- }
44
- return self::$_instance;
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- function enqueue_scripts()
48
- {
 
49
 
50
- global $current_section;
 
51
 
52
- $admin_field = include_once(WOOCCM_PLUGIN_DIR . 'assets/backend/js/admin-field.asset.php');
53
 
54
- wp_register_script('wooccm-admin-field', plugins_url('assets/backend/js/admin-field.js', WOOCCM_PLUGIN_FILE), $admin_field['dependencies'], $admin_field['dependencies'], true);
55
 
56
- wp_localize_script('wooccm-admin-field', 'wooccm_field', array(
57
- 'ajax_url' => admin_url('admin-ajax.php?section=' . $current_section),
58
- 'nonce' => wp_create_nonce('wooccm_field'),
59
- 'args' => WOOCCM()->billing->get_args(),
60
- 'message' => array(
61
- 'remove' => esc_html__('Are you sure you want to remove this field?', 'woocommerce-checkout-manager'),
62
- 'reset' => esc_html__('Are you sure you want to reset this fields?', 'woocommerce-checkout-manager')
63
- )
64
- ));
65
 
66
- if (isset($_GET['tab']) && $_GET['tab'] === WOOCCM_PREFIX) {
67
- wp_enqueue_style('media-views');
68
- wp_enqueue_script('wooccm-admin-field');
69
- }
70
- }
71
 
72
- public function get_product_categories()
73
- {
74
 
75
- $args = array(
76
- 'taxonomy' => 'product_cat',
77
- 'orderby' => 'id',
78
- 'order' => 'ASC',
79
- 'hide_empty' => true,
80
- 'fields' => 'all'
81
- );
82
-
83
- return get_terms($args);
84
- }
85
 
86
- // Ajax
87
- // ---------------------------------------------------------------------------
88
 
89
- public function ajax_toggle_field_attribute()
90
- {
 
 
 
 
91
 
92
- if (
93
- current_user_can('manage_woocommerce') &&
94
- check_ajax_referer('wooccm_field', 'nonce') &&
95
- isset($_REQUEST['section']) &&
96
- isset($_REQUEST['field_id']) &&
97
- isset($_REQUEST['field_attr'])
98
- ) {
99
 
100
- $section = wc_clean(wp_unslash($_REQUEST['section']));
 
 
 
 
 
101
 
102
- if (isset(WOOCCM()->$section)) {
103
 
104
- $field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
105
- $attr = wc_clean(wp_unslash($_REQUEST['field_attr']));
106
 
107
- if ($field = WOOCCM()->$section->get_field($field_id)) {
 
 
108
 
109
- $value = $field[$attr] = !(bool) @$field[$attr];
 
110
 
111
- WOOCCM()->$section->update_field($field);
 
 
 
 
 
112
 
113
- parent::success_ajax($value);
114
- }
115
- }
116
- }
117
 
118
- parent::error_reload_page();
119
- }
120
 
121
- public function ajax_change_field_attribute()
122
- {
123
 
124
- if (
125
- current_user_can('manage_woocommerce') &&
126
- check_ajax_referer('wooccm_field', 'nonce') &&
127
- isset($_REQUEST['section']) &&
128
- isset($_REQUEST['field_id']) &&
129
- isset($_REQUEST['field_attr']) &&
130
- isset($_REQUEST['field_value'])
131
- ) {
132
 
133
- $section = wc_clean(wp_unslash($_REQUEST['section']));
 
134
 
135
- if (isset(WOOCCM()->$section)) {
 
 
 
 
 
136
 
137
- $field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
138
- $attr = wc_clean(wp_unslash($_REQUEST['field_attr']));
139
 
140
- if ($field = WOOCCM()->$section->get_field($field_id)) {
 
 
141
 
142
- $value = $field[$attr] = wc_clean(wp_unslash($_REQUEST['field_value']));
 
143
 
144
- $field = WOOCCM()->$section->update_field($field);
 
145
 
146
- parent::success_ajax($value);
147
- }
148
- }
149
- }
150
 
151
- parent::error_reload_page();
152
- }
153
 
154
- public function ajax_save_field()
155
- {
156
 
157
- if (isset($_REQUEST['field_data']) && current_user_can('manage_woocommerce') && check_ajax_referer('wooccm_field', 'nonce', false)) {
158
- $field_data = json_decode(stripslashes($_REQUEST['field_data']), true);
159
- if (is_array($field_data)) {
160
- if (isset($field_data['id'])) {
161
 
162
- unset($field_data['show_product_selected']);
163
- unset($field_data['hide_product_selected']);
164
 
165
- return parent::success_ajax($this->save_modal_field($field_data));
166
- } else {
167
- return parent::success_ajax($this->add_modal_field($field_data));
168
- }
169
- }
170
- }
171
 
172
- return parent::error_reload_page();
173
- }
174
 
175
- public function ajax_delete_field()
176
- {
 
 
 
 
 
 
 
 
177
 
178
- if (
179
- current_user_can('manage_woocommerce') &&
180
- check_ajax_referer('wooccm_field', 'nonce') &&
181
- isset($_REQUEST['field_id'])
182
- ) {
183
 
184
- $field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
 
185
 
186
- if ($this->delete_field($field_id)) {
 
 
 
187
 
188
- parent::success_ajax($field_id);
189
- }
190
- }
191
 
192
- parent::error_reload_page();
193
- }
 
 
 
 
194
 
195
- public function ajax_reset_fields()
196
- {
197
 
198
- if (
199
- current_user_can('manage_woocommerce') &&
200
- check_ajax_referer('wooccm_field', 'nonce') &&
201
- isset($_REQUEST['section'])
202
- ) {
203
 
204
- $section = wc_clean(wp_unslash($_REQUEST['section']));
205
 
206
- if (isset(WOOCCM()->$section)) {
207
 
208
- WOOCCM()->$section->delete_fields();
209
 
210
- parent::success_ajax();
211
- }
212
- }
213
 
214
- parent::error_reload_page();
215
- }
216
 
217
- public function ajax_load_field()
218
- {
 
 
 
 
 
 
219
 
220
- if (
221
- current_user_can('manage_woocommerce') &&
222
- check_ajax_referer('wooccm_field', 'nonce') &&
223
- isset($_REQUEST['field_id'])
224
- ) {
225
 
226
- $field_id = wc_clean(wp_unslash($_REQUEST['field_id']));
 
227
 
228
- if ($field = $this->get_modal_field($field_id)) {
229
- parent::success_ajax($field);
230
- }
231
 
232
- parent::error_ajax(esc_html__('Undefined field id', 'woocommerce-checkout-manager'));
233
- }
234
 
235
- parent::error_reload_page();
236
- }
237
 
238
- // Modal
239
- // ---------------------------------------------------------------------------
 
 
 
 
 
 
240
 
241
- public function get_modal_field($field_id)
242
- {
 
 
243
 
244
- if (array_key_exists('section', $_REQUEST)) {
 
245
 
246
- $section = wc_clean(wp_unslash($_REQUEST['section']));
247
 
248
- if (isset(WOOCCM()->$section)) {
249
 
250
- if ($fields = WOOCCM()->$section->get_fields()) {
 
 
 
251
 
252
- if (isset($fields[$field_id])) {
 
253
 
254
- $field = $fields[$field_id];
255
 
256
- if (!empty($field['show_product'])) {
257
- $field['show_product_selected'] = array_filter(array_combine((array) $field['show_product'], array_map('get_the_title', (array) $field['show_product'])));
258
- } else {
259
- $field['show_product_selected'] = array();
260
- }
261
- if (!empty($field['hide_product'])) {
262
- $field['hide_product_selected'] = array_filter(array_combine((array) $field['hide_product'], array_map('get_the_title', (array) $field['hide_product'])));
263
- } else {
264
- $field['hide_product_selected'] = array();
265
- }
266
 
267
- if (!empty($field['conditional_parent_key']) && $field['conditional_parent_key'] != $field['key']) {
 
 
 
268
 
269
- // $parent_id = @max(array_keys(array_column($fields, 'key'), $field['conditional_parent_key']));
270
- $parent_id = WOOCCM()->$section->get_field_id($fields, 'key', $field['conditional_parent_key']);
271
 
272
- if (isset($fields[$parent_id])) {
273
- $field['parent'] = $fields[$parent_id];
274
- }
275
- }
276
 
277
- //don't remove empty attr because previus data remain
278
- //$field = array_filter($field);
279
 
280
- return $field;
281
- }
282
- }
283
- }
284
- }
285
- }
286
 
287
- public function ajax_load_parent()
288
- {
289
 
290
- if (!empty($_REQUEST['conditional_parent_key'])) {
291
 
292
- $key = $_REQUEST['conditional_parent_key'];
293
 
294
- if (array_key_exists('section', $_REQUEST)) {
295
 
296
- $section = wc_clean(wp_unslash($_REQUEST['section']));
297
 
298
- if (isset(WOOCCM()->$section)) {
299
 
300
- if ($fields = WOOCCM()->$section->get_fields()) {
301
 
302
- $parent_id = WOOCCM()->$section->get_field_id($fields, 'key', $key);
303
 
304
- if (isset($fields[$parent_id])) {
305
- parent::success_ajax($fields[$parent_id]);
306
- }
307
- }
308
- }
309
- }
310
- }
311
- }
312
 
313
- // Save
314
- // ---------------------------------------------------------------------------
315
-
316
- public function save_modal_field($field_data)
317
- {
318
-
319
- if (array_key_exists('section', $_REQUEST)) {
320
-
321
- $section = wc_clean(wp_unslash($_REQUEST['section']));
322
-
323
- if (isset(WOOCCM()->$section)) {
324
-
325
- $field_data = wp_parse_args($field_data, WOOCCM()->$section->get_args());
326
-
327
- /**
328
- * Don't override this fields, they are handled trough the interface toggles.
329
- */
330
- unset($field_data['order']);
331
- unset($field_data['required']);
332
- // unset($field_data['position']);
333
- unset($field_data['clear']);
334
- unset($field_data['disabled']);
335
-
336
- return WOOCCM()->$section->update_field($field_data);
337
- }
338
- }
339
- }
340
-
341
- public function add_modal_field($field_data)
342
- {
343
- if (array_key_exists('section', $_REQUEST)) {
344
-
345
- $section = wc_clean(wp_unslash($_REQUEST['section']));
346
-
347
- if (isset(WOOCCM()->$section)) {
348
-
349
- return WOOCCM()->$section->add_field($field_data);
350
- }
351
- }
352
- }
353
-
354
- public function delete_field($field_id)
355
- {
356
-
357
- if (array_key_exists('section', $_REQUEST)) {
358
-
359
- $section = wc_clean(wp_unslash($_REQUEST['section']));
360
-
361
- if (isset(WOOCCM()->$section)) {
362
-
363
- return WOOCCM()->$section->delete_field($field_id);
364
- }
365
- }
366
- }
367
-
368
- function save_field_order()
369
- {
370
-
371
- global $current_section;
372
-
373
- if (in_array($current_section, array('billing', 'shipping', 'additional'))) {
374
-
375
- $section = wc_clean(wp_unslash($current_section));
376
-
377
- if (array_key_exists('field_order', $_POST)) {
378
-
379
- $field_order = wc_clean(wp_unslash($_POST['field_order']));
380
-
381
- if (is_array($field_order) && count($field_order) > 0) {
382
-
383
- if (isset(WOOCCM()->$section)) {
384
-
385
- $fields = WOOCCM()->$section->get_fields();
386
-
387
- $loop = 1;
388
-
389
- foreach ($field_order as $field_id) {
390
-
391
- if (isset($fields[$field_id])) {
392
-
393
- $fields[$field_id]['order'] = $loop;
394
-
395
- $loop++;
396
- }
397
- }
398
-
399
- WOOCCM()->$section->update_fields($fields);
400
- }
401
- }
402
- }
403
- }
404
- }
405
  }
406
 
407
  WOOCCM_Field_Controller::instance();
1
  <?php
2
 
3
+ require_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-controller.php';
4
+
5
+ class WOOCCM_Field_Controller extends WOOCCM_Controller {
6
+
7
+
8
+ protected static $_instance;
9
+ public $billing;
10
+
11
+ public function __construct() {
12
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-billing.php';
13
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-shipping.php';
14
+ include_once WOOCCM_PLUGIN_DIR . 'includes/controller/class-wooccm-field-additional.php';
15
+ include_once WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-i18n.php';
16
+
17
+ if ( ! is_admin() ) {
18
+ include_once WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-register.php';
19
+ include_once WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-additional.php';
20
+ include_once WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-disable.php';
21
+ include_once WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-conditional.php';
22
+ include_once WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-handler.php';
23
+ include_once WOOCCM_PLUGIN_DIR . 'includes/view/frontend/class-wooccm-fields-filters.php';
24
+ }
25
+
26
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
27
+ add_action( 'wp_ajax_wooccm_load_parent', array( $this, 'ajax_load_parent' ) );
28
+ add_action( 'wp_ajax_wooccm_load_field', array( $this, 'ajax_load_field' ) );
29
+ add_action( 'wp_ajax_wooccm_save_field', array( $this, 'ajax_save_field' ) );
30
+ add_action( 'wp_ajax_wooccm_delete_field', array( $this, 'ajax_delete_field' ) );
31
+ add_action( 'wp_ajax_wooccm_reset_fields', array( $this, 'ajax_reset_fields' ) );
32
+ add_action( 'wp_ajax_wooccm_change_field_attribute', array( $this, 'ajax_change_field_attribute' ) );
33
+ add_action( 'wp_ajax_wooccm_toggle_field_attribute', array( $this, 'ajax_toggle_field_attribute' ) );
34
+ add_action( 'woocommerce_settings_save_' . WOOCCM_PREFIX, array( $this, 'save_field_order' ) );
35
+ }
36
+
37
+ public static function instance() {
38
+ if ( is_null( self::$_instance ) ) {
39
+ self::$_instance = new self();
40
+ }
41
+ return self::$_instance;
42
+ }
43
+
44
+ function enqueue_scripts() {
45
+ global $current_section;
46
+
47
+ // $admin_field = include_once WOOCCM_PLUGIN_DIR . 'assets/backend/js/admin-field.asset.php';
48
+
49
+ // wp_register_script( 'wooccm-admin-js', plugins_url( 'assets/backend/js/admin-field.js', WOOCCM_PLUGIN_FILE ), $admin_field['dependencies'], $admin_field['dependencies'], true );
50
+
51
+ wp_localize_script(
52
+ 'wooccm-admin-js',
53
+ 'wooccm_field',
54
+ array(
55
+ 'ajax_url' => admin_url( 'admin-ajax.php?section=' . $current_section ),
56
+ 'nonce' => wp_create_nonce( 'wooccm_field' ),
57
+ 'args' => WOOCCM()->billing->get_args(),
58
+ 'message' => array(
59
+ 'remove' => esc_html__( 'Are you sure you want to remove this field?', 'woocommerce-checkout-manager' ),
60
+ 'reset' => esc_html__( 'Are you sure you want to reset this fields?', 'woocommerce-checkout-manager' ),
61
+ ),
62
+ )
63
+ );
64
+
65
+ if ( isset( $_GET['tab'] ) && $_GET['tab'] === WOOCCM_PREFIX ) {
66
+ wp_enqueue_style( 'media-views' );
67
+ wp_enqueue_script( 'wooccm-admin-js' );
68
+ }
69
+ }
70
+
71
+ public function get_product_categories() {
72
+ $args = array(
73
+ 'taxonomy' => 'product_cat',
74
+ 'orderby' => 'id',
75
+ 'order' => 'ASC',
76
+ 'hide_empty' => true,
77
+ 'fields' => 'all',
78
+ );
79
+
80
+ return get_terms( $args );
81
+ }
82
+
83
+ // Ajax
84
+ // ---------------------------------------------------------------------------
85
+
86
+ public function ajax_toggle_field_attribute() {
87
+ if (
88
+ current_user_can( 'manage_woocommerce' ) &&
89
+ check_ajax_referer( 'wooccm_field', 'nonce' ) &&
90
+ isset( $_REQUEST['section'] ) &&
91
+ isset( $_REQUEST['field_id'] ) &&
92
+ isset( $_REQUEST['field_attr'] )
93
+ ) {
94
+
95
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
96
+
97
+ if ( isset( WOOCCM()->$section ) ) {
98
+
99
+ $field_id = wc_clean( wp_unslash( $_REQUEST['field_id'] ) );
100
+ $attr = wc_clean( wp_unslash( $_REQUEST['field_attr'] ) );
101
+
102
+ if ( $field = WOOCCM()->$section->get_field( $field_id ) ) {
103
+
104
+ $value = $field[ $attr ] = ! (bool) @$field[ $attr ];
105
+
106
+ WOOCCM()->$section->update_field( $field );
107
+
108
+ parent::success_ajax( $value );
109
+ }
110
+ }
111
+ }
112
+
113
+ parent::error_reload_page();
114
+ }
115
+
116
+ public function ajax_change_field_attribute() {
117
+ if (
118
+ current_user_can( 'manage_woocommerce' ) &&
119
+ check_ajax_referer( 'wooccm_field', 'nonce' ) &&
120
+ isset( $_REQUEST['section'] ) &&
121
+ isset( $_REQUEST['field_id'] ) &&
122
+ isset( $_REQUEST['field_attr'] ) &&
123
+ isset( $_REQUEST['field_value'] )
124
+ ) {
125
 
126
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
127
+
128
+ if ( isset( WOOCCM()->$section ) ) {
129
 
130
+ $field_id = wc_clean( wp_unslash( $_REQUEST['field_id'] ) );
131
+ $attr = wc_clean( wp_unslash( $_REQUEST['field_attr'] ) );
132
 
133
+ if ( $field = WOOCCM()->$section->get_field( $field_id ) ) {
134
 
135
+ $value = $field[ $attr ] = wc_clean( wp_unslash( $_REQUEST['field_value'] ) );
136
 
137
+ $field = WOOCCM()->$section->update_field( $field );
 
 
 
 
 
 
 
 
138
 
139
+ parent::success_ajax( $value );
140
+ }
141
+ }
142
+ }
 
143
 
144
+ parent::error_reload_page();
145
+ }
146
 
147
+ public function ajax_save_field() {
148
+ if ( isset( $_REQUEST['field_data'] ) && current_user_can( 'manage_woocommerce' ) && check_ajax_referer( 'wooccm_field', 'nonce', false ) ) {
149
+ $field_data = json_decode( stripslashes( $_REQUEST['field_data'] ), true );
150
+ if ( is_array( $field_data ) ) {
151
+ if ( isset( $field_data['id'] ) ) {
 
 
 
 
 
152
 
153
+ unset( $field_data['show_product_selected'] );
154
+ unset( $field_data['hide_product_selected'] );
155
 
156
+ return parent::success_ajax( $this->save_modal_field( $field_data ) );
157
+ } else {
158
+ return parent::success_ajax( $this->add_modal_field( $field_data ) );
159
+ }
160
+ }
161
+ }
162
 
163
+ return parent::error_reload_page();
164
+ }
 
 
 
 
 
165
 
166
+ public function ajax_delete_field() {
167
+ if (
168
+ current_user_can( 'manage_woocommerce' ) &&
169
+ check_ajax_referer( 'wooccm_field', 'nonce' ) &&
170
+ isset( $_REQUEST['field_id'] )
171
+ ) {
172
 
173
+ $field_id = wc_clean( wp_unslash( $_REQUEST['field_id'] ) );
174
 
175
+ if ( $this->delete_field( $field_id ) ) {
 
176
 
177
+ parent::success_ajax( $field_id );
178
+ }
179
+ }
180
 
181
+ parent::error_reload_page();
182
+ }
183
 
184
+ public function ajax_reset_fields() {
185
+ if (
186
+ current_user_can( 'manage_woocommerce' ) &&
187
+ check_ajax_referer( 'wooccm_field', 'nonce' ) &&
188
+ isset( $_REQUEST['section'] )
189
+ ) {
190
 
191
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
 
 
 
192
 
193
+ if ( isset( WOOCCM()->$section ) ) {
 
194
 
195
+ WOOCCM()->$section->delete_fields();
 
196
 
197
+ parent::success_ajax();
198
+ }
199
+ }
 
 
 
 
 
200
 
201
+ parent::error_reload_page();
202
+ }
203
 
204
+ public function ajax_load_field() {
205
+ if (
206
+ current_user_can( 'manage_woocommerce' ) &&
207
+ check_ajax_referer( 'wooccm_field', 'nonce' ) &&
208
+ isset( $_REQUEST['field_id'] )
209
+ ) {
210
 
211
+ $field_id = wc_clean( wp_unslash( $_REQUEST['field_id'] ) );
 
212
 
213
+ if ( $field = $this->get_modal_field( $field_id ) ) {
214
+ parent::success_ajax( $field );
215
+ }
216
 
217
+ parent::error_ajax( esc_html__( 'Undefined field id', 'woocommerce-checkout-manager' ) );
218
+ }
219
 
220
+ parent::error_reload_page();
221
+ }
222
 
223
+ // Modal
224
+ // ---------------------------------------------------------------------------
 
 
225
 
226
+ public function get_modal_field( $field_id ) {
227
+ if ( array_key_exists( 'section', $_REQUEST ) ) {
228
 
229
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
 
230
 
231
+ if ( isset( WOOCCM()->$section ) ) {
 
 
 
232
 
233
+ if ( $fields = WOOCCM()->$section->get_fields() ) {
 
234
 
235
+ if ( isset( $fields[ $field_id ] ) ) {
 
 
 
 
 
236
 
237
+ $field = $fields[ $field_id ];
 
238
 
239
+ if ( ! empty( $field['show_product'] ) ) {
240
+ $field['show_product_selected'] = array_filter( array_combine( (array) $field['show_product'], array_map( 'get_the_title', (array) $field['show_product'] ) ) );
241
+ } else {
242
+ $field['show_product_selected'] = array();
243
+ }
244
+ if ( ! empty( $field['hide_product'] ) ) {
245
+ $field['hide_product_selected'] = array_filter( array_combine( (array) $field['hide_product'], array_map( 'get_the_title', (array) $field['hide_product'] ) ) );
246
+ } else {
247
+ $field['hide_product_selected'] = array();
248
+ }
249
 
250
+ if ( ! empty( $field['conditional_parent_key'] ) && $field['conditional_parent_key'] != $field['key'] ) {
 
 
 
 
251
 
252
+ // $parent_id = @max(array_keys(array_column($fields, 'key'), $field['conditional_parent_key']));
253
+ $parent_id = WOOCCM()->$section->get_field_id( $fields, 'key', $field['conditional_parent_key'] );
254
 
255
+ if ( isset( $fields[ $parent_id ] ) ) {
256
+ $field['parent'] = $fields[ $parent_id ];
257
+ }
258
+ }
259
 
260
+ // don't remove empty attr because previus data remain
261
+ // $field = array_filter($field);
 
262
 
263
+ return $field;
264
+ }
265
+ }
266
+ }
267
+ }
268
+ }
269
 
270
+ public function ajax_load_parent() {
271
+ if ( ! empty( $_REQUEST['conditional_parent_key'] ) ) {
272
 
273
+ $key = $_REQUEST['conditional_parent_key'];
 
 
 
 
274
 
275
+ if ( array_key_exists( 'section', $_REQUEST ) ) {
276
 
277
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
278
 
279
+ if ( isset( WOOCCM()->$section ) ) {
280
 
281
+ if ( $fields = WOOCCM()->$section->get_fields() ) {
 
 
282
 
283
+ $parent_id = WOOCCM()->$section->get_field_id( $fields, 'key', $key );
 
284
 
285
+ if ( isset( $fields[ $parent_id ] ) ) {
286
+ parent::success_ajax( $fields[ $parent_id ] );
287
+ }
288
+ }
289
+ }
290
+ }
291
+ }
292
+ }
293
 
294
+ // Save
295
+ // ---------------------------------------------------------------------------
 
 
 
296
 
297
+ public function save_modal_field( $field_data ) {
298
+ if ( array_key_exists( 'section', $_REQUEST ) ) {
299
 
300
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
 
 
301
 
302
+ if ( isset( WOOCCM()->$section ) ) {
 
303
 
304
+ $field_data = wp_parse_args( $field_data, WOOCCM()->$section->get_args() );
 
305
 
306
+ /**
307
+ * Don't override this fields, they are handled trough the interface toggles.
308
+ */
309
+ unset( $field_data['order'] );
310
+ unset( $field_data['required'] );
311
+ // unset($field_data['position']);
312
+ unset( $field_data['clear'] );
313
+ unset( $field_data['disabled'] );
314
 
315
+ return WOOCCM()->$section->update_field( $field_data );
316
+ }
317
+ }
318
+ }
319
 
320
+ public function add_modal_field( $field_data ) {
321
+ if ( array_key_exists( 'section', $_REQUEST ) ) {
322
 
323
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
324
 
325
+ if ( isset( WOOCCM()->$section ) ) {
326
 
327
+ return WOOCCM()->$section->add_field( $field_data );
328
+ }
329
+ }
330
+ }
331
 
332
+ public function delete_field( $field_id ) {
333
+ if ( array_key_exists( 'section', $_REQUEST ) ) {
334
 
335
+ $section = wc_clean( wp_unslash( $_REQUEST['section'] ) );
336
 
337
+ if ( isset( WOOCCM()->$section ) ) {
 
 
 
 
 
 
 
 
 
338
 
339
+ return WOOCCM()->$section->delete_field( $field_id );
340
+ }
341
+ }
342
+ }
343
 
344
+ function save_field_order() {
345
+ global $current_section;
346
 
347
+ if ( in_array( $current_section, array( 'billing', 'shipping', 'additional' ) ) ) {
 
 
 
348
 
349
+ $section = wc_clean( wp_unslash( $current_section ) );
 
350
 
351
+ if ( array_key_exists( 'field_order', $_POST ) ) {
 
 
 
 
 
352
 
353
+ $field_order = wc_clean( wp_unslash( $_POST['field_order'] ) );
 
354
 
355
+ if ( is_array( $field_order ) && count( $field_order ) > 0 ) {
356
 
357
+ if ( isset( WOOCCM()->$section ) ) {
358
 
359
+ $fields = WOOCCM()->$section->get_fields();
360
 
361
+ $loop = 1;
362
 
363
+ foreach ( $field_order as $field_id ) {
364
 
365
+ if ( isset( $fields[ $field_id ] ) ) {
366
 
367
+ $fields[ $field_id ]['order'] = $loop;
368
 
369
+ $loop++;
370
+ }
371
+ }
 
 
 
 
 
372
 
373
+ WOOCCM()->$section->update_fields( $fields );
374
+ }
375
+ }
376
+ }
377
+ }
378
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  }
380
 
381
  WOOCCM_Field_Controller::instance();
includes/controller/class-wooccm-order.php CHANGED
@@ -51,7 +51,7 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
51
 
52
  wp_enqueue_style( 'wooccm-checkout-css' );
53
  wp_enqueue_style( 'dashicons' );
54
- wp_enqueue_script( 'wooccm-order-upload' );
55
  }
56
  }
57
 
@@ -62,7 +62,7 @@ class WOOCCM_Order_Controller extends WOOCCM_Upload {
62
 
63
  WOOCCM()->register_scripts();
64
 
65
- wp_enqueue_script( 'wooccm-order-upload' );
66
  }
67
  }
68
  }
51
 
52
  wp_enqueue_style( 'wooccm-checkout-css' );
53
  wp_enqueue_style( 'dashicons' );
54
+ wp_enqueue_script( 'wooccm-frontend-js' );
55
  }
56
  }
57
 
62
 
63
  WOOCCM()->register_scripts();
64
 
65
+ wp_enqueue_script( 'wooccm-frontend-js' );
66
  }
67
  }
68
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: checkout field editor, woocommerce checkout field editor, checkout manager
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
- Stable tag: 6.2.6
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.9
11
  License: GPLv3
@@ -149,6 +149,9 @@ Your Order data can be reviewed in each order within the default WooCommerce Ord
149
 
150
  == Changelog ==
151
 
 
 
 
152
  = 6.2.6
153
  * Fix. WooCommerce compatibility
154
 
5
  Requires at least: 4.9
6
  Tested up to: 6.0.1
7
  Requires PHP: 5.6
8
+ Stable tag: 6.2.7
9
  WC requires at least: 3.1.0
10
  WC tested up to: 6.9
11
  License: GPLv3
149
 
150
  == Changelog ==
151
 
152
+ = 6.2.7
153
+ * Fix. Elementor checkout upload
154
+
155
  = 6.2.6
156
  * Fix. WooCommerce compatibility
157
 
woocommerce-checkout-manager.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
- * Version: 6.2.6
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
17
  }
18
 
19
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
20
- define( 'WOOCCM_PLUGIN_VERSION', '6.2.6' );
21
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );
22
  define( 'WOOCCM_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
23
  define( 'WOOCCM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
4
  * Plugin Name: Checkout Fields Manager for WooCommerce
5
  * Plugin URI: https://quadlayers.com/portfolio/woocommerce-checkout-manager/
6
  * Description: Manage and customize WooCommerce Checkout fields (Add, Edit, Delete or re-order fields).
7
+ * Version: 6.2.7
8
  * Author: QuadLayers
9
  * Author URI: https://quadlayers.com
10
  * License: GPLv3
17
  }
18
 
19
  define( 'WOOCCM_PLUGIN_NAME', 'Checkout Fields Manager for WooCommerce' );
20
+ define( 'WOOCCM_PLUGIN_VERSION', '6.2.7' );
21
  define( 'WOOCCM_PLUGIN_FILE', __FILE__ );
22
  define( 'WOOCCM_PLUGIN_DIR', __DIR__ . DIRECTORY_SEPARATOR );
23
  define( 'WOOCCM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );