'use strict';/**
 * @param acp_woocommerce_i18n {Object}
 */(function($){'use strict';var Dimensions=function Dimensions(options){this.init('dimensions',options,Dimensions.defaults)};$.fn.editableutils.inherit(Dimensions,$.fn.editabletypes.abstractinput);$.extend(Dimensions.prototype,{activate:function activate(){this.$input.find('input:first').focus()},value2input:function value2input(value){if(!value){return}this.$input.filter('[name="length"]').val(value.length);this.$input.filter('[name="width"]').val(value.width);this.$input.filter('[name="height"]').val(value.height)},input2value:function input2value(){return{length:this.$input.filter('[name="length"]').val(),width:this.$input.filter('[name="width"]').val(),height:this.$input.filter('[name="height"]').val()}}});var template='';template+='<input type="text" class="form-control input-sm small-text" name="length" placeholder="'+acp_woocommerce_i18n.woocommerce.length+'">';template+='<input type="text" class="form-control input-sm small-text" name="width" placeholder="'+acp_woocommerce_i18n.woocommerce.width+'">';template+='<input type="text" class="form-control input-sm small-text" name="height" placeholder="'+acp_woocommerce_i18n.woocommerce.height+'">';Dimensions.defaults=$.extend({},$.fn.editabletypes.abstractinput.defaults,{tpl:template});$.fn.editabletypes.dimensions=Dimensions})(window.jQuery);jQuery.fn.cacie_edit_dimensions=function(column,item){var el=jQuery(this);el.cacie_xeditable({type:'dimensions',value:el.cacie_get_value(column,item),validate:function validate(value){if(!cacie_is_float(value.length)||!cacie_is_float(value.width)||!cacie_is_float(value.height)){return acp_woocommerce_i18n.errors.invalid_floats}}},column,item)};
'use strict';(function($){'use strict';var ACP_WC_Variation=function ACP_WC_Variation(options){this.init('wc_variation',options,ACP_WC_Variation.defaults)};$.fn.editableutils.inherit(ACP_WC_Variation,$.fn.editabletypes.abstractinput);$.extend(ACP_WC_Variation.prototype,{value2input:function value2input(value){var $input=this.$input;var plugin=this;if(!value){return}$.each(this.options.attributes,function(key,attribute){$input.append(plugin.attributeSelectHtml(key,attribute.label,attribute.options))});$.each(value,function(key,v){$input.find('select[name='+key+']').val(v)})},attributeSelectHtml:function attributeSelectHtml(key,label,options){var $row=$('<div class="attribute-row"><label>'+label+'</label></div>');var $select=$('<select name="'+key+'"></select>');$select.data('attribute',key);$select.append('<option value="">Any '+label+'</option>');$.each(options,function(key,option){$select.append('<option value="'+key+'" >'+option+'</option>')});$row.append($select);return $row},input2value:function input2value(){var result={};this.$input.find('select').each(function(){result[$(this).data('attribute')]=$(this).val()});return result}});var template='<div class="attributes"></div>';ACP_WC_Variation.defaults=$.extend({},$.fn.editabletypes.abstractinput.defaults,{tpl:template,attributes:{}});$.fn.editabletypes.wc_variation=ACP_WC_Variation})(window.jQuery);jQuery.fn.cacie_edit_wc_variation=function(column,item){var el=jQuery(this);var col_value=el.cacie_get_value(column,item);el.cacie_xeditable({type:'wc_variation',attributes:col_value.options,value:col_value.value,showbuttons:'bottom'},column,item)};
'use strict';(function($){'use strict';var WC_Price=function WC_Price(options){this.init('wc_price',options,WC_Price.defaults)};$.fn.editableutils.inherit(WC_Price,$.fn.editabletypes.abstractinput);$.extend(WC_Price.prototype,{render:function render(){var container=this.$input;container.find('.toggle-price-schedule').click(function(e){e.preventDefault();var el=container.find('.price-schedule');if(el.is(':visible')){el.hide();$(this).text('Schedule');container.find('.price-schedule input').val('')}else{el.show();$(this).text('Cancel')}});var dates=$('.price-schedule input').datepicker({defaultDate:'',dateFormat:'yy-mm-dd',numberOfMonths:1,showButtonPanel:true,showOn:'button',buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:true,onSelect:function onSelect(selectedDate){var option=$(this).is('[name="sale_price_dates_from"]')?'minDate':'maxDate';var instance=$(this).data('datepicker');var date=$.datepicker.parseDate(instance.settings.dateFormat||$.datepicker._defaults.dateFormat,selectedDate,instance.settings);dates.not(this).datepicker('option',option,date)}})},activate:function activate(){var value=this.input2value();this.$input.find('input:first').focus();if(value.sale_price_dates_from||value.sale_price_dates_to){this.$input.find('.toggle-price-schedule').trigger('click')}},value2input:function value2input(value){if(!value){return}this.$input.find('[name="regular_price"]').val(value.regular_price);this.$input.find('[name="sale_price"]').val(value.sale_price);this.$input.find('[name="sale_price_dates_from"]').val(value.sale_price_dates_from);this.$input.find('[name="sale_price_dates_to"]').val(value.sale_price_dates_to)},input2value:function input2value(){return{regular_price:this.$input.find('[name="regular_price"]').val(),sale_price:this.$input.find('[name="sale_price"]').val(),sale_price_dates_from:this.$input.find('[name="sale_price_dates_from"]').val(),sale_price_dates_to:this.$input.find('[name="sale_price_dates_to"]').val()}}});var template='';var currency_symbol='$';if(typeof woocommerce_admin_meta_boxes!=='undefined'&&typeof woocommerce_admin_meta_boxes.currency_format_symbol!=='undefined'){currency_symbol=woocommerce_admin_meta_boxes.currency_format_symbol}template+='<div>';template+='<div>';template+='<label>'+acp_woocommerce_i18n.woocommerce.regular+' ('+currency_symbol+')</label>';template+='<input type="text" class="form-control input-sm" name="regular_price">';template+='</div>';template+='<div>';template+='<label>'+acp_woocommerce_i18n.woocommerce.sale+' ('+currency_symbol+')</label>';template+='<input type="text" class="form-control input-sm" name="sale_price">';template+='</div>';template+='<div class="price-schedule">';template+='<div>';template+='<label>'+acp_woocommerce_i18n.woocommerce.sale_from+'</label>';template+='<input type="text" placeholder="yyyy-mm-dd" class="form-control input-sm" name="sale_price_dates_from">';template+='</div>';template+='<div>';template+='<label>'+acp_woocommerce_i18n.woocommerce.sale_to+'</label>';template+='<input type="text" placeholder="yyyy-mm-dd" class="form-control input-sm" name="sale_price_dates_to">';template+='</div>';template+='</div>';template+='<div>';template+='<a href="#" class="toggle-price-schedule">'+acp_woocommerce_i18n.woocommerce.schedule+'</a>';template+='</div>';template+='</div>';WC_Price.defaults=$.extend({},$.fn.editabletypes.abstractinput.defaults,{tpl:template});$.fn.editabletypes.wc_price=WC_Price})(window.jQuery);jQuery.fn.cacie_edit_wc_price=function(column,item){var el=jQuery(this);el.cacie_xeditable({type:'wc_price',value:el.cacie_get_value(column,item)},column,item)};
'use strict';(function($){'use strict';var WC_Stock=function WC_Stock(options){this.init('wc_stock',options,WC_Stock.defaults)};$.fn.editableutils.inherit(WC_Stock,$.fn.editabletypes.abstractinput);$.extend(WC_Stock.prototype,{render:function render(){var container=this.$input;container.find('#manage_stock').change(function(){if($(this).is(':checked')){container.find('#stock').parent().show();$('#ac-xedit-stock-status').hide()}else{container.find('#stock').parent().hide();$('#ac-xedit-stock-status').show()}})},postrender:function postrender(){this.$input.find('#manage_stock').trigger('change')},value2input:function value2input(value){if(!value){return}if(typeof this.woocommerce_option_manage_stock==='undefined'){this.woocommerce_option_manage_stock=value.woocommerce_option_manage_stock}this.$input.find('[name="stock_status"] [value="'+value.stock_status+'"]').prop('selected',true);if(this.woocommerce_option_manage_stock){this.$input.find('[name="manage_stock"]').prop('checked','yes'===value.manage_stock);this.$input.find('[name="stock"]').val(value.stock)}else{this.$input.find('.show-if-option-manage-stock').hide()}},input2value:function input2value(){var value={manage_stock:'',stock:'',stock_status:this.$input.find('[name="stock_status"]').val()};if(this.$input.find('[name="manage_stock"]').is(':checked')){value.manage_stock='yes';value.stock=this.$input.find('[name="stock"]').val()}return value}});var template='';template+='<div>';template+='<input type="hidden" name="woocommerce_option_manage_stock" />';template+='<div class="show-if-option-manage-stock">';template+='<label for="manage_stock" class="inline-label">'+acp_woocommerce_i18n.woocommerce.manage_stock+'</label>';template+='<input type="checkbox" name="manage_stock" id="manage_stock" value="yes" />';template+='</div>';template+='<div>';template+='<label for="stock">'+acp_woocommerce_i18n.woocommerce.stock_qty+'</label>';template+='<input type="text" class="form-control input-sm" id="stock" name="stock">';template+='</div>';template+='<div id="ac-xedit-stock-status">';template+='<label for="stock_status">'+acp_woocommerce_i18n.woocommerce.stock_status+'</label>';template+='<select class="form-control" id="stock_status" name="stock_status">';template+='<option value="instock">'+acp_woocommerce_i18n.woocommerce.in_stock+'</option>';template+='<option value="outofstock">'+acp_woocommerce_i18n.woocommerce.out_of_stock+'</option>';template+='</select>';template+='</div>';template+='</div>';WC_Stock.defaults=$.extend({},$.fn.editabletypes.abstractinput.defaults,{tpl:template});$.fn.editabletypes.wc_stock=WC_Stock})(window.jQuery);jQuery.fn.cacie_edit_wc_stock=function(column,item){var el=jQuery(this);el.cacie_xeditable({type:'wc_stock',value:el.cacie_get_value(column,item)},column,item)};
'use strict';(function($){'use strict';var WC_Usage=function WC_Usage(options){this.init('wc_usage',options,WC_Usage.defaults)};$.fn.editableutils.inherit(WC_Usage,$.fn.editabletypes.abstractinput);$.extend(WC_Usage.prototype,{value2input:function value2input(value){if(!value){return}this.$input.find('[name="usage_limit"]').val(value.usage_limit);this.$input.find('[name="usage_limit_per_user"]').val(value.usage_limit_per_user);this.$input.find('[name="usage_limit_products"]').val(value.usage_limit_products)},input2value:function input2value(){return{usage_limit:this.$input.find('[name="usage_limit"]').val(),usage_limit_per_user:this.$input.find('[name="usage_limit_per_user"]').val(),usage_limit_products:this.$input.find('[name="usage_limit_products"]').val()}}});var template='';template+='<div>';template+='<div>';template+='<label>'+acp_woocommerce_i18n.woocommerce.usage_limit_per_coupon+'</label>';template+='<input type="text" class="form-control input-sm small-text" name="usage_limit">';template+='</div>';template+='<div>';template+='<label>'+acp_woocommerce_i18n.woocommerce.usage_limit_per_user+'</label>';template+='<input type="text" class="form-control input-sm small-text" name="usage_limit_per_user">';template+='</div>';template+='<div>';template+='<label>'+acp_woocommerce_i18n.woocommerce.usage_limit_products+'</label>';template+='<input type="text" class="form-control input-sm small-text" name="usage_limit_products">';template+='</div>';template+='</div>';WC_Usage.defaults=$.extend({},$.fn.editabletypes.abstractinput.defaults,{tpl:template});$.fn.editabletypes.wc_usage=WC_Usage})(window.jQuery);jQuery.fn.cacie_edit_wc_usage=function(column,item){var el=jQuery(this);el.cacie_xeditable({type:'wc_usage',value:el.cacie_get_value(column,item)},column,item)};
