diff --git a/assets/js/admin/meta-boxes.js b/assets/js/admin/meta-boxes.js
index d30a6791412..99064b2235e 100644
--- a/assets/js/admin/meta-boxes.js
+++ b/assets/js/admin/meta-boxes.js
@@ -309,12 +309,12 @@ jQuery( function($){
$('#woocommerce-order-totals').on( 'change input', '.order_taxes_amount, .order_taxes_shipping_amount, .shipping_cost, #_order_discount', function() {
var $this = $(this);
- var fields = $this.closest('.totals_group').find('input[type=number], .wc_input_decimal');
+ var fields = $this.closest('.totals_group').find('input[type=number], .wc_input_price');
var total = 0;
fields.each(function(){
if ( $(this).val() )
- total = total + parseFloat( $(this).val() );
+ total = total + accounting.unformat( $(this).val(), woocommerce_admin.mon_decimal_point );
});
if ( $this.is('.order_taxes_amount') || $this.is('.order_taxes_shipping_amount') ) {
@@ -385,9 +385,9 @@ jQuery( function($){
order_shipping = 0;
- $('#shipping_rows').find('input[type=number], .wc_input_decimal').each(function(){
+ $('#shipping_rows').find('input[type=number], .wc_input_price').each(function(){
cost = $(this).val() || '0';
- cost = accounting.unformat( cost.replace(',', '.') );
+ cost = accounting.unformat( cost, woocommerce_admin.mon_decimal_point );
order_shipping = order_shipping + parseFloat( cost );
});
@@ -449,15 +449,15 @@ jQuery( function($){
order_discount = accounting.unformat( order_discount.replace(',', '.') );
- $('#shipping_rows').find('input[type=number], .wc_input_decimal').each(function(){
+ $('#shipping_rows').find('input[type=number], .wc_input_price').each(function(){
cost = $(this).val() || '0';
- cost = accounting.unformat( cost.replace(',', '.') );
+ cost = accounting.unformat( cost, woocommerce_admin.mon_decimal_point );
shipping = shipping + parseFloat( cost );
});
- $('#tax_rows').find('input[type=number], .wc_input_decimal').each(function(){
+ $('#tax_rows').find('input[type=number], .wc_input_price').each(function(){
cost = $(this).val() || '0';
- cost = accounting.unformat( cost.replace(',', '.') );
+ cost = accounting.unformat( cost, woocommerce_admin.mon_decimal_point );
tax = tax + parseFloat( cost );
});
@@ -471,7 +471,7 @@ jQuery( function($){
tax = parseFloat( accounting.toFixed( tax, woocommerce_admin_meta_boxes.rounding_precision ) );
// Set Total
- $('#_order_total').val( parseFloat( accounting.toFixed( line_totals + tax + shipping - order_discount, woocommerce_admin_meta_boxes.currency_format_num_decimals ) ) ).change();
+ $('#_order_total').val( accounting.formatNumber( line_totals + tax + shipping - order_discount, woocommerce_admin_meta_boxes.currency_format_num_decimals, '', woocommerce_admin.mon_decimal_point ) ).change();
}
$('#woocommerce-order-totals').unblock();
diff --git a/assets/js/admin/meta-boxes.min.js b/assets/js/admin/meta-boxes.min.js
index cf7f5331a7f..739502cd31a 100644
--- a/assets/js/admin/meta-boxes.min.js
+++ b/assets/js/admin/meta-boxes.min.js
@@ -1 +1 @@
-jQuery(function(e){function t(){var t=e("select#product-type").val(),n=e("input#_virtual:checked").size(),r=e("input#_downloadable:checked").size(),i=".hide_if_downloadable, .hide_if_virtual",s=".show_if_downloadable, .show_if_virtual, .show_if_external";e.each(woocommerce_admin_meta_boxes.product_types,function(e,t){i=i+", .hide_if_"+t;s=s+", .show_if_"+t});e(i).show();e(s).hide();r&&e(".show_if_downloadable").show();n&&e(".show_if_virtual").show();e(".show_if_"+t).show();r&&e(".hide_if_downloadable").hide();n&&e(".hide_if_virtual").hide();e(".hide_if_"+t).hide();e("input#_manage_stock").change()}function i(){e(".product_attributes .woocommerce_attribute").each(function(t,n){e(".attribute_position",n).val(parseInt(e(n).index(".product_attributes .woocommerce_attribute")))})}e("#titlediv #title").keyup(function(t){var n=t.keyCode||t.which;if(n=="9"&&e("#woocommerce-coupon-description").size()>0){t.stopPropagation();e("#woocommerce-coupon-description").focus();return!1}});e("select#discount_type").change(function(){var t=e(this).val();t=="fixed_product"||t=="percent_product"?e(".limit_usage_to_x_items_field").show():e(".limit_usage_to_x_items_field").hide()}).change();e(function(){e('[id$="-all"] > ul.categorychecklist').each(function(){var t=e(this),n=t.find(":checked").first();if(!n.length)return;var r=t.find("input").position().top,i=n.position().top;t.closest(".tabs-panel").scrollTop(i-r+5)})});e("#upsell_product_data").bind("keypress",function(e){if(e.keyCode==13)return!1});e(".type_box").appendTo("#woocommerce-product-data h3.hndle span");e(function(){e("#woocommerce-product-data h3.hndle").unbind("click.postboxes");jQuery("#woocommerce-product-data").on("click","h3.hndle",function(t){if(e(t.target).filter("input, option, label, select").length)return;e("#woocommerce-product-data").toggleClass("closed")})});e("#order-emails a.show-order-emails").click(function(){if(e("#order-emails-select").is(":hidden")){e("#order-emails-select").slideDown("fast");e(this).hide()}return!1});e("#order-emails a.hide-order-emails").click(function(){e('input[name="order_email[]"]').each(function(){e(this).attr("checked",!1)});if(e("#order-emails-select").is(":visible")){e("#order-emails-select").slideUp("fast");e("#order-emails a.show-order-emails").show()}return!1});e("#catalog-visibility .edit-catalog-visibility").click(function(){if(e("#catalog-visibility-select").is(":hidden")){e("#catalog-visibility-select").slideDown("fast");e(this).hide()}return!1});e("#catalog-visibility .save-post-visibility").click(function(){e("#catalog-visibility-select").slideUp("fast");e("#catalog-visibility .edit-catalog-visibility").show();var t=e("input[name=_visibility]:checked").val(),n=e("input[name=_visibility]:checked").attr("data-label");if(e("input[name=_featured]").is(":checked")){n=n+", "+woocommerce_admin_meta_boxes.featured_label;e("input[name=_featured]").attr("checked","checked")}e("#catalog-visibility-display").text(n);return!1});e("#catalog-visibility .cancel-post-visibility").click(function(){e("#catalog-visibility-select").slideUp("fast");e("#catalog-visibility .edit-catalog-visibility").show();var t=e("#current_visibility").val(),n=e("#current_featured").val();e("input[name=_visibility]").removeAttr("checked");e("input[name=_visibility][value="+t+"]").attr("checked","checked");var r=e("input[name=_visibility]:checked").attr("data-label");if(n=="yes"){r=r+", "+woocommerce_admin_meta_boxes.featured_label;e("input[name=_featured]").attr("checked","checked")}else e("input[name=_featured]").removeAttr("checked");e("#catalog-visibility-display").text(r);return!1});e("ul.wc-tabs").show();e("div.panel-wrap").each(function(){e(this).find("div.panel:not(:first)").hide()});e("ul.wc-tabs a").click(function(){var t=e(this).closest("div.panel-wrap");e("ul.wc-tabs li",t).removeClass("active");e(this).parent().addClass("active");e("div.panel",t).hide();e(e(this).attr("href")).show();return!1});jQuery("select.chosen_select").chosen();jQuery("select.chosen_select_nostd").chosen({allow_single_deselect:"true"});jQuery("select.ajax_chosen_select_products").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(t){var n={};e.each(t,function(e,t){n[e]=t});return n});jQuery("select.ajax_chosen_select_products_and_variations").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products_and_variations",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(t){var n={};e.each(t,function(e,t){n[e]=t});return n});jQuery("#woocommerce-order-actions input, #woocommerce-order-actions a").click(function(){window.onbeforeunload=""});e("a.edit_address").click(function(t){e(this).hide();e(this).closest(".order_data_column").find("div.address").hide();e(this).closest(".order_data_column").find("div.edit_address").show();t.preventDefault()});e("#order_items_list").on("init_row","tr.item",function(){var t=e(this),n=t.find("input.quantity"),r=n.val(),i=t.find("input.line_subtotal").val(),s=t.find("input.line_total").val(),o=t.find("input.line_tax").val(),u=t.find("input.line_subtotal_tax").val();if(r){unit_subtotal=parseFloat(accounting.toFixed(i/r,woocommerce_admin_meta_boxes.rounding_precision));unit_subtotal_tax=parseFloat(accounting.toFixed(u/r,woocommerce_admin_meta_boxes.rounding_precision));unit_total=parseFloat(accounting.toFixed(s/r,woocommerce_admin_meta_boxes.rounding_precision));unit_total_tax=parseFloat(accounting.toFixed(o/r,woocommerce_admin_meta_boxes.rounding_precision))}else unit_subtotal=unit_subtotal_tax=unit_total=unit_total_tax=0;n.attr("data-o_qty",r);t.attr("data-unit_subtotal",unit_subtotal);t.attr("data-unit_subtotal_tax",unit_subtotal_tax);t.attr("data-unit_total",unit_total);t.attr("data-unit_total_tax",unit_total_tax)});e("#order_items_list tr.item").each(function(){e(this).trigger("init_row");e(this).find(".edit").hide()});e("#order_items_list").on("click","a.edit_order_item",function(){e(this).closest("tr").find(".view").hide();e(this).closest("tr").find(".edit").show();e(this).hide();return!1});e("#order_items_list").on("change","input.quantity",function(){var t=e(this).closest("tr.item"),n=e(this).val(),r=t.attr("data-unit_subtotal"),i=t.attr("data-unit_subtotal_tax"),s=t.attr("data-unit_total"),o=t.attr("data-unit_total_tax"),u=e(this).attr("data-o_qty"),a=parseFloat(accounting.formatNumber(r*n,woocommerce_admin_meta_boxes.rounding_precision,"")),f=parseFloat(accounting.formatNumber(i*n,woocommerce_admin_meta_boxes.rounding_precision,"")),l=parseFloat(accounting.formatNumber(s*n,woocommerce_admin_meta_boxes.rounding_precision,"")),c=parseFloat(accounting.formatNumber(o*n,woocommerce_admin_meta_boxes.rounding_precision,""));t.find("input.line_subtotal").val(a);t.find("input.line_total").val(l);t.find("input.line_subtotal_tax").val(f);t.find("input.line_tax").val(c);e(this).trigger("quantity_changed")});e("#order_items_list").on("change","input.line_subtotal",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_subtotal",i)});e("#order_items_list").on("change","input.line_total",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_total",i)});e("#order_items_list").on("change","input.line_subtotal_tax",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_subtotal_tax",i)});e("#order_items_list").on("change","input.line_tax",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_total_tax",i)});e("#woocommerce-order-totals").on("change input",".order_taxes_amount, .order_taxes_shipping_amount, .shipping_cost, #_order_discount",function(){var t=e(this),n=t.closest(".totals_group").find("input[type=number], .wc_input_decimal"),r=0;n.each(function(){e(this).val()&&(r+=parseFloat(e(this).val()))});if(t.is(".order_taxes_amount")||t.is(".order_taxes_shipping_amount"))r=round(r,woocommerce_admin_meta_boxes.currency_format_num_decimals,woocommerce_admin_meta_boxes.tax_rounding_mode);var i=accounting.formatMoney(r,{symbol:woocommerce_admin_meta_boxes.currency_format_symbol,decimal:woocommerce_admin_meta_boxes.currency_format_decimal_sep,thousand:woocommerce_admin_meta_boxes.currency_format_thousand_sep,precision:woocommerce_admin_meta_boxes.currency_format_num_decimals,format:woocommerce_admin_meta_boxes.currency_format});t.closest(".totals_group").find("span.inline_total").text(i)});e("span.inline_total").closest(".totals_group").find("input").change();e("button.calc_line_taxes").click(function(){e(".woocommerce_order_items_wrapper").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t=confirm(woocommerce_admin_meta_boxes.calc_line_taxes);if(t){var n=e("#order_items_list").find("tr.item, tr.fee"),r=e("#_shipping_country").val(),i=e("#_billing_country").val();if(r)var s=r,o=e("#_shipping_state").val(),u=e("#_shipping_postcode").val(),a=e("#_shipping_city").val();else if(i)var s=i,o=e("#_billing_state").val(),u=e("#_billing_postcode").val(),a=e("#_billing_city").val();else var s=woocommerce_admin_meta_boxes.base_country,o="",u="",a="";var f={};n.each(function(){var t=e(this),n=t.find("input.order_item_id").val(),r=t.find("input.line_subtotal").val(),i=t.find("input.line_total").val(),s=t.find("select.tax_class").val();f[n]={};f[n].line_subtotal=r;f[n].line_total=i;f[n].tax_class=s});order_shipping=0;e("#shipping_rows").find("input[type=number], .wc_input_decimal").each(function(){cost=e(this).val()||"0";cost=accounting.unformat(cost.replace(",","."));order_shipping+=parseFloat(cost)});var l={action:"woocommerce_calc_line_taxes",order_id:woocommerce_admin_meta_boxes.post_id,items:f,shipping:order_shipping,country:s,state:o,postcode:u,city:a,security:woocommerce_admin_meta_boxes.calc_totals_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,l,function(t){if(t){n.each(function(){var n=e(this),r=n.find("input.order_item_id").val();n.find(".edit_order_item").click();if(t.item_taxes[r]){n.find("input.line_tax").val(t.item_taxes[r].line_tax).change();n.find("input.line_subtotal_tax").val(t.item_taxes[r].line_subtotal_tax).change()}t.tax_row_html&&e("#tax_rows").empty().append(t.tax_row_html)});e("#tax_rows").find("input").change()}e(".woocommerce_order_items_wrapper").unblock()})}else e(".woocommerce_order_items_wrapper").unblock();return!1});e("button.calc_totals").click(function(){e("#woocommerce-order-totals").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t=confirm(woocommerce_admin_meta_boxes.calc_totals);if(t){var n=0,r=0,i=0,s=e("#_order_discount").val()||"0";s=accounting.unformat(s.replace(",","."));e("#shipping_rows").find("input[type=number], .wc_input_decimal").each(function(){cost=e(this).val()||"0";cost=accounting.unformat(cost.replace(",","."));i+=parseFloat(cost)});e("#tax_rows").find("input[type=number], .wc_input_decimal").each(function(){cost=e(this).val()||"0";cost=accounting.unformat(cost.replace(",","."));r+=parseFloat(cost)});e("#order_items_list tr.item, #order_items_list tr.fee").each(function(){line_total=e(this).find("input.line_total").val()||"0";n+=accounting.unformat(line_total.replace(",","."))});woocommerce_admin_meta_boxes.round_at_subtotal=="yes"&&(r=parseFloat(accounting.toFixed(r,woocommerce_admin_meta_boxes.rounding_precision)));e("#_order_total").val(parseFloat(accounting.toFixed(n+r+i-s,woocommerce_admin_meta_boxes.currency_format_num_decimals))).change()}e("#woocommerce-order-totals").unblock();return!1});e("#woocommerce-order-items button.add_order_item").click(function(){var t=e("select#add_item_id").val();if(t){count=t.length;e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.each(t,function(t,n){var r={action:"woocommerce_add_order_item",item_to_add:n,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,r,function(t){e("table.woocommerce_order_items tbody#order_items_list").append(t);if(!--count){e("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","").val("");jQuery(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200});e("select#add_item_id").trigger("chosen:updated");e("table.woocommerce_order_items").unblock()}e("#order_items_list tr.new_row").trigger("init_row").removeClass("new_row")})})}else e("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","red");return!1});e("#woocommerce-order-items button.add_order_fee").click(function(){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t={action:"woocommerce_add_order_fee",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,t,function(t){e("table.woocommerce_order_items tbody#order_items_list").append(t);e("table.woocommerce_order_items").unblock()});return!1});e("#order_items_list").on("click","button.add_order_item_meta",function(){var t=e(this),n=t.closest("tr.item"),r={order_item_id:n.attr("data-order_item_id"),action:"woocommerce_add_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){n.find("tbody.meta_items").append(t);e("table.woocommerce_order_items").unblock()}});return!1});e("#order_items_list").on("click","button.remove_order_item_meta",function(){var t=confirm(woocommerce_admin_meta_boxes.remove_item_meta);if(t){var n=e(this).closest("tr"),r={meta_id:n.attr("data-meta_id"),action:"woocommerce_remove_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){n.hide();e("table.woocommerce_order_items").unblock()}})}return!1});e("#woocommerce-order-items").on("click","input.check-column",function(){e(this).is(":checked")?e("#woocommerce-order-items").find(".check-column input").attr("checked","checked"):e("#woocommerce-order-items").find(".check-column input").removeAttr("checked")});e("#woocommerce-order-items").on("click",".do_bulk_action",function(){var t=e(this).closest(".bulk_actions").find("select").val(),n=e("#woocommerce-order-items").find(".check-column input:checked"),r=[];e(n).each(function(){var t=e(this).closest("tr.item, tr.fee");r.push(t.attr("data-order_item_id"))});if(r.length==0){alert(woocommerce_admin_meta_boxes.i18n_select_items);return}if(t=="delete"){var i=confirm(woocommerce_admin_meta_boxes.remove_item_notice);if(i){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var s={order_item_ids:r,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce};e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:s,type:"POST",success:function(t){e(n).each(function(){e(this).closest("tr.item, tr.fee").remove()});e("table.woocommerce_order_items").unblock()}})}}else if(t=="reduce_stock"){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var o={};e(n).each(function(){var t=e(this).closest("tr.item, tr.fee"),n=t.find("input.quantity");o[t.attr("data-order_item_id")]=n.val()});var s={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:r,order_item_qty:o,action:"woocommerce_reduce_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:s,type:"POST",success:function(t){alert(t);e("table.woocommerce_order_items").unblock()}})}else if(t=="increase_stock"){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var o={};e(n).each(function(){var t=e(this).closest("tr.item, tr.fee"),n=t.find("input.quantity");o[t.attr("data-order_item_id")]=n.val()});var s={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:r,order_item_qty:o,action:"woocommerce_increase_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:s,type:"POST",success:function(t){alert(t);e("table.woocommerce_order_items").unblock()}})}return!1});e("button.load_customer_billing").click(function(){var t=confirm(woocommerce_admin_meta_boxes.load_billing);if(t){var n=e("#customer_user").val();if(!n){alert(woocommerce_admin_meta_boxes.no_customer_selected);return!1}var r={user_id:n,type_to_load:"billing",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};e(this).closest(".edit_address").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){var n=t;if(n){e("input#_billing_first_name").val(n.billing_first_name);e("input#_billing_last_name").val(n.billing_last_name);e("input#_billing_company").val(n.billing_company);e("input#_billing_address_1").val(n.billing_address_1);e("input#_billing_address_2").val(n.billing_address_2);e("input#_billing_city").val(n.billing_city);e("input#_billing_postcode").val(n.billing_postcode);e("#_billing_country").val(n.billing_country);e("input#_billing_state").val(n.billing_state);e("input#_billing_email").val(n.billing_email);e("input#_billing_phone").val(n.billing_phone)}e(".edit_address").unblock()}})}return!1});e("button.load_customer_shipping").click(function(){var t=confirm(woocommerce_admin_meta_boxes.load_shipping);if(t){var n=e("#customer_user").val();if(!n){alert(woocommerce_admin_meta_boxes.no_customer_selected);return!1}var r={user_id:n,type_to_load:"shipping",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};e(this).closest(".edit_address").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){var n=t;if(n){e("input#_shipping_first_name").val(n.shipping_first_name);e("input#_shipping_last_name").val(n.shipping_last_name);e("input#_shipping_company").val(n.shipping_company);e("input#_shipping_address_1").val(n.shipping_address_1);e("input#_shipping_address_2").val(n.shipping_address_2);e("input#_shipping_city").val(n.shipping_city);e("input#_shipping_postcode").val(n.shipping_postcode);e("#_shipping_country").val(n.shipping_country);e("input#_shipping_state").val(n.shipping_state)}e(".edit_address").unblock()}})}return!1});e("button.billing-same-as-shipping").click(function(){var t=confirm(woocommerce_admin_meta_boxes.copy_billing);if(t){e("input#_shipping_first_name").val(e("input#_billing_first_name").val());e("input#_shipping_last_name").val(e("input#_billing_last_name").val());e("input#_shipping_company").val(e("input#_billing_company").val());e("input#_shipping_address_1").val(e("input#_billing_address_1").val());e("input#_shipping_address_2").val(e("input#_billing_address_2").val());e("input#_shipping_city").val(e("input#_billing_city").val());e("input#_shipping_postcode").val(e("input#_billing_postcode").val());e("#_shipping_country").val(e("#_billing_country").val());e("input#_shipping_state").val(e("input#_billing_state").val())}return!1});e(".totals_group").on("click","a.add_total_row",function(){e(this).closest(".totals_group").find(".total_rows").append(e(this).data("row"));return!1});e(".total_rows").on("click","a.delete_total_row",function(){$row=e(this).closest(".total_row");var t=$row.attr("data-order_item_id");t?$row.append('').hide():$row.remove();return!1});e("select#product-type").change(function(){var n=e(this).val();if(n=="variable"){e("input#_manage_stock").change();e("input#_downloadable").prop("checked",!1);e("input#_virtual").removeAttr("checked")}else if(n=="grouped"){e("input#_downloadable").prop("checked",!1);e("input#_virtual").removeAttr("checked")}else if(n=="external"){e("input#_downloadable").prop("checked",!1);e("input#_virtual").removeAttr("checked")}t();e("ul.wc-tabs li:visible").eq(0).find("a").click();e("body").trigger("woocommerce-product-type-change",n,e(this))}).change();e("ul.wc-tabs li:visible").eq(0).find("a").click();e("input#_downloadable, input#_virtual").change(function(){t()});e(".sale_price_dates_fields").each(function(){var t=e(this),n=!1,r=t.closest("div, table");t.find("input").each(function(){e(this).val()!=""&&(n=!0)});if(n){r.find(".sale_schedule").hide();r.find(".sale_price_dates_fields").show()}else{r.find(".sale_schedule").show();r.find(".sale_price_dates_fields").hide()}});e("#woocommerce-product-data").on("click",".sale_schedule",function(){var t=e(this).closest("div, table");e(this).hide();t.find(".cancel_sale_schedule").show();t.find(".sale_price_dates_fields").show();return!1});e("#woocommerce-product-data").on("click",".cancel_sale_schedule",function(){var t=e(this).closest("div, table");e(this).hide();t.find(".sale_schedule").show();t.find(".sale_price_dates_fields").hide();t.find(".sale_price_dates_fields").find("input").val("");return!1});e(".downloadable_files").on("click","a.insert",function(){e(this).closest(".downloadable_files").find("tbody").append(e(this).data("row"));return!1});e(".downloadable_files").on("click","a.delete",function(){e(this).closest("tr").remove();return!1});e("input#_manage_stock").change(function(){e(this).is(":checked")?e("div.stock_fields").show():e("div.stock_fields").hide()}).change();var n=e(".sale_price_dates_fields input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0,onSelect:function(t){var r=e(this).is("#_sale_price_dates_from, .sale_price_dates_from")?"minDate":"maxDate",i=e(this).data("datepicker"),s=e.datepicker.parseDate(i.settings.dateFormat||e.datepicker._defaults.dateFormat,t,i.settings);n.not(this).datepicker("option",r,s)}});e(".date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0});e(".date-picker-field").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0});jQuery(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(t){if(e(t.target).filter(":input, option").length)return;jQuery(this).next(".wc-metabox-content").toggle()}).on("click",".expand_all",function(e){jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > table").show();return!1}).on("click",".close_all",function(e){jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > table").hide();return!1});jQuery(".wc-metabox.closed").each(function(){jQuery(this).find(".wc-metabox-content").hide()});e(".product_attributes select.multiselect").chosen();var r=e(".product_attributes").find(".woocommerce_attribute").get();r.sort(function(t,n){var r=parseInt(e(t).attr("rel")),i=parseInt(e(n).attr("rel"));return ri?1:0});e(r).each(function(t,n){e(".product_attributes").append(n)});e("button.add_attribute").on("click",function(){var t=e(".product_attributes .woocommerce_attribute").size(),n=e("select.attribute_taxonomy").val();if(!n){var r=e("select#product-type").val();r!="variable"?enable_variation='style="display:none;"':enable_variation="";e(".product_attributes").append('")}else{var s=e(".product_attributes .woocommerce_attribute."+n);e(".product_attributes").append(e(s));e(s).show().find(".woocommerce_attribute_data").show();i()}e("select.attribute_taxonomy").val("")});e(".product_attributes").on("blur","input.attribute_name",function(){e(this).closest(".woocommerce_attribute").find("strong.attribute_name").text(e(this).val())});e(".product_attributes").on("click","button.select_all_attributes",function(){e(this).closest("td").find("select option").attr("selected","selected");e(this).closest("td").find("select").trigger("chosen:updated");return!1});e(".product_attributes").on("click","button.select_no_attributes",function(){e(this).closest("td").find("select option").removeAttr("selected");e(this).closest("td").find("select").trigger("chosen:updated");return!1});e(".product_attributes").on("click","button.remove_row",function(){var t=confirm(woocommerce_admin_meta_boxes.remove_attribute);if(t){var n=e(this).parent().parent();if(n.is(".taxonomy")){n.find("select, input[type=text]").val("");n.hide()}else{n.find("select, input[type=text]").val("");n.hide();i()}}return!1});e(".product_attributes").sortable({items:".woocommerce_attribute",cursor:"move",axis:"y",handle:"h3",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style");i()}});e(".product_attributes").on("click","button.add_new_attribute",function(){e(".product_attributes").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t=e(this).attr("data-attribute"),n=e(this).closest(".woocommerce_attribute_data"),r=prompt(woocommerce_admin_meta_boxes.new_attribute_prompt);if(r){var i={action:"woocommerce_add_new_attribute",taxonomy:t,term:r,security:woocommerce_admin_meta_boxes.add_attribute_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,i,function(t){if(t.error)alert(t.error);else if(t.slug){n.find("select.attribute_values").append('");n.find("select.attribute_values").trigger("chosen:updated")}e(".product_attributes").unblock()})}else e(".product_attributes").unblock();return!1});e(".save_attributes").on("click",function(){e(".product_attributes").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t={post_id:woocommerce_admin_meta_boxes.post_id,data:e(".product_attributes").find("input, select, textarea").serialize(),action:"woocommerce_save_attributes",security:woocommerce_admin_meta_boxes.save_attributes_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,t,function(t){var n=window.location.toString();n=n.replace("post-new.php?","post.php?post="+woocommerce_admin_meta_boxes.post_id+"&action=edit&");e("#variable_product_options").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e("#variable_product_options").load(n+" #variable_product_options_inner",function(){e("#variable_product_options").unblock()});e(".product_attributes").unblock()})});var s,o;jQuery(document).on("click",".upload_file_button",function(t){var n=e(this);o=n.closest("tr").find("td.file_url input");t.preventDefault();if(s){s.open();return}var r=[new wp.media.controller.Library({library:wp.media.query(),multiple:!0,title:n.data("choose"),priority:20,filterable:"uploaded"})];s=wp.media.frames.downloadable_file=wp.media({title:n.data("choose"),library:{type:""},button:{text:n.data("update")},multiple:!0,states:r});s.on("select",function(){var e="",t=s.state().get("selection");t.map(function(t){t=t.toJSON();t.url&&(e=t.url)});o.val(e)});s.on("ready",function(){s.uploader.options.uploader.params={type:"downloadable_product"}});s.open()});jQuery(".downloadable_files tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65})});
\ No newline at end of file
+jQuery(function(e){function t(){var t=e("select#product-type").val(),n=e("input#_virtual:checked").size(),r=e("input#_downloadable:checked").size(),i=".hide_if_downloadable, .hide_if_virtual",s=".show_if_downloadable, .show_if_virtual, .show_if_external";e.each(woocommerce_admin_meta_boxes.product_types,function(e,t){i=i+", .hide_if_"+t;s=s+", .show_if_"+t});e(i).show();e(s).hide();r&&e(".show_if_downloadable").show();n&&e(".show_if_virtual").show();e(".show_if_"+t).show();r&&e(".hide_if_downloadable").hide();n&&e(".hide_if_virtual").hide();e(".hide_if_"+t).hide();e("input#_manage_stock").change()}function i(){e(".product_attributes .woocommerce_attribute").each(function(t,n){e(".attribute_position",n).val(parseInt(e(n).index(".product_attributes .woocommerce_attribute")))})}e("#titlediv #title").keyup(function(t){var n=t.keyCode||t.which;if(n=="9"&&e("#woocommerce-coupon-description").size()>0){t.stopPropagation();e("#woocommerce-coupon-description").focus();return!1}});e("select#discount_type").change(function(){var t=e(this).val();t=="fixed_product"||t=="percent_product"?e(".limit_usage_to_x_items_field").show():e(".limit_usage_to_x_items_field").hide()}).change();e(function(){e('[id$="-all"] > ul.categorychecklist').each(function(){var t=e(this),n=t.find(":checked").first();if(!n.length)return;var r=t.find("input").position().top,i=n.position().top;t.closest(".tabs-panel").scrollTop(i-r+5)})});e("#upsell_product_data").bind("keypress",function(e){if(e.keyCode==13)return!1});e(".type_box").appendTo("#woocommerce-product-data h3.hndle span");e(function(){e("#woocommerce-product-data h3.hndle").unbind("click.postboxes");jQuery("#woocommerce-product-data").on("click","h3.hndle",function(t){if(e(t.target).filter("input, option, label, select").length)return;e("#woocommerce-product-data").toggleClass("closed")})});e("#order-emails a.show-order-emails").click(function(){if(e("#order-emails-select").is(":hidden")){e("#order-emails-select").slideDown("fast");e(this).hide()}return!1});e("#order-emails a.hide-order-emails").click(function(){e('input[name="order_email[]"]').each(function(){e(this).attr("checked",!1)});if(e("#order-emails-select").is(":visible")){e("#order-emails-select").slideUp("fast");e("#order-emails a.show-order-emails").show()}return!1});e("#catalog-visibility .edit-catalog-visibility").click(function(){if(e("#catalog-visibility-select").is(":hidden")){e("#catalog-visibility-select").slideDown("fast");e(this).hide()}return!1});e("#catalog-visibility .save-post-visibility").click(function(){e("#catalog-visibility-select").slideUp("fast");e("#catalog-visibility .edit-catalog-visibility").show();var t=e("input[name=_visibility]:checked").val(),n=e("input[name=_visibility]:checked").attr("data-label");if(e("input[name=_featured]").is(":checked")){n=n+", "+woocommerce_admin_meta_boxes.featured_label;e("input[name=_featured]").attr("checked","checked")}e("#catalog-visibility-display").text(n);return!1});e("#catalog-visibility .cancel-post-visibility").click(function(){e("#catalog-visibility-select").slideUp("fast");e("#catalog-visibility .edit-catalog-visibility").show();var t=e("#current_visibility").val(),n=e("#current_featured").val();e("input[name=_visibility]").removeAttr("checked");e("input[name=_visibility][value="+t+"]").attr("checked","checked");var r=e("input[name=_visibility]:checked").attr("data-label");if(n=="yes"){r=r+", "+woocommerce_admin_meta_boxes.featured_label;e("input[name=_featured]").attr("checked","checked")}else e("input[name=_featured]").removeAttr("checked");e("#catalog-visibility-display").text(r);return!1});e("ul.wc-tabs").show();e("div.panel-wrap").each(function(){e(this).find("div.panel:not(:first)").hide()});e("ul.wc-tabs a").click(function(){var t=e(this).closest("div.panel-wrap");e("ul.wc-tabs li",t).removeClass("active");e(this).parent().addClass("active");e("div.panel",t).hide();e(e(this).attr("href")).show();return!1});jQuery("select.chosen_select").chosen();jQuery("select.chosen_select_nostd").chosen({allow_single_deselect:"true"});jQuery("select.ajax_chosen_select_products").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(t){var n={};e.each(t,function(e,t){n[e]=t});return n});jQuery("select.ajax_chosen_select_products_and_variations").ajaxChosen({method:"GET",url:woocommerce_admin_meta_boxes.ajax_url,dataType:"json",afterTypeDelay:100,data:{action:"woocommerce_json_search_products_and_variations",security:woocommerce_admin_meta_boxes.search_products_nonce}},function(t){var n={};e.each(t,function(e,t){n[e]=t});return n});jQuery("#woocommerce-order-actions input, #woocommerce-order-actions a").click(function(){window.onbeforeunload=""});e("a.edit_address").click(function(t){e(this).hide();e(this).closest(".order_data_column").find("div.address").hide();e(this).closest(".order_data_column").find("div.edit_address").show();t.preventDefault()});e("#order_items_list").on("init_row","tr.item",function(){var t=e(this),n=t.find("input.quantity"),r=n.val(),i=t.find("input.line_subtotal").val(),s=t.find("input.line_total").val(),o=t.find("input.line_tax").val(),u=t.find("input.line_subtotal_tax").val();if(r){unit_subtotal=parseFloat(accounting.toFixed(i/r,woocommerce_admin_meta_boxes.rounding_precision));unit_subtotal_tax=parseFloat(accounting.toFixed(u/r,woocommerce_admin_meta_boxes.rounding_precision));unit_total=parseFloat(accounting.toFixed(s/r,woocommerce_admin_meta_boxes.rounding_precision));unit_total_tax=parseFloat(accounting.toFixed(o/r,woocommerce_admin_meta_boxes.rounding_precision))}else unit_subtotal=unit_subtotal_tax=unit_total=unit_total_tax=0;n.attr("data-o_qty",r);t.attr("data-unit_subtotal",unit_subtotal);t.attr("data-unit_subtotal_tax",unit_subtotal_tax);t.attr("data-unit_total",unit_total);t.attr("data-unit_total_tax",unit_total_tax)});e("#order_items_list tr.item").each(function(){e(this).trigger("init_row");e(this).find(".edit").hide()});e("#order_items_list").on("click","a.edit_order_item",function(){e(this).closest("tr").find(".view").hide();e(this).closest("tr").find(".edit").show();e(this).hide();return!1});e("#order_items_list").on("change","input.quantity",function(){var t=e(this).closest("tr.item"),n=e(this).val(),r=t.attr("data-unit_subtotal"),i=t.attr("data-unit_subtotal_tax"),s=t.attr("data-unit_total"),o=t.attr("data-unit_total_tax"),u=e(this).attr("data-o_qty"),a=parseFloat(accounting.formatNumber(r*n,woocommerce_admin_meta_boxes.rounding_precision,"")),f=parseFloat(accounting.formatNumber(i*n,woocommerce_admin_meta_boxes.rounding_precision,"")),l=parseFloat(accounting.formatNumber(s*n,woocommerce_admin_meta_boxes.rounding_precision,"")),c=parseFloat(accounting.formatNumber(o*n,woocommerce_admin_meta_boxes.rounding_precision,""));t.find("input.line_subtotal").val(a);t.find("input.line_total").val(l);t.find("input.line_subtotal_tax").val(f);t.find("input.line_tax").val(c);e(this).trigger("quantity_changed")});e("#order_items_list").on("change","input.line_subtotal",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_subtotal",i)});e("#order_items_list").on("change","input.line_total",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_total",i)});e("#order_items_list").on("change","input.line_subtotal_tax",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_subtotal_tax",i)});e("#order_items_list").on("change","input.line_tax",function(){var t=e(this).closest("tr.item"),n=t.find("input.quantity"),r=n.val(),i=r?accounting.toFixed(e(this).val()/r,woocommerce_admin_meta_boxes.rounding_precision):0;t.attr("data-unit_total_tax",i)});e("#woocommerce-order-totals").on("change input",".order_taxes_amount, .order_taxes_shipping_amount, .shipping_cost, #_order_discount",function(){var t=e(this),n=t.closest(".totals_group").find("input[type=number], .wc_input_price"),r=0;n.each(function(){e(this).val()&&(r+=accounting.unformat(e(this).val(),woocommerce_admin.mon_decimal_point))});if(t.is(".order_taxes_amount")||t.is(".order_taxes_shipping_amount"))r=round(r,woocommerce_admin_meta_boxes.currency_format_num_decimals,woocommerce_admin_meta_boxes.tax_rounding_mode);var i=accounting.formatMoney(r,{symbol:woocommerce_admin_meta_boxes.currency_format_symbol,decimal:woocommerce_admin_meta_boxes.currency_format_decimal_sep,thousand:woocommerce_admin_meta_boxes.currency_format_thousand_sep,precision:woocommerce_admin_meta_boxes.currency_format_num_decimals,format:woocommerce_admin_meta_boxes.currency_format});t.closest(".totals_group").find("span.inline_total").text(i)});e("span.inline_total").closest(".totals_group").find("input").change();e("button.calc_line_taxes").click(function(){e(".woocommerce_order_items_wrapper").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t=confirm(woocommerce_admin_meta_boxes.calc_line_taxes);if(t){var n=e("#order_items_list").find("tr.item, tr.fee"),r=e("#_shipping_country").val(),i=e("#_billing_country").val();if(r)var s=r,o=e("#_shipping_state").val(),u=e("#_shipping_postcode").val(),a=e("#_shipping_city").val();else if(i)var s=i,o=e("#_billing_state").val(),u=e("#_billing_postcode").val(),a=e("#_billing_city").val();else var s=woocommerce_admin_meta_boxes.base_country,o="",u="",a="";var f={};n.each(function(){var t=e(this),n=t.find("input.order_item_id").val(),r=t.find("input.line_subtotal").val(),i=t.find("input.line_total").val(),s=t.find("select.tax_class").val();f[n]={};f[n].line_subtotal=r;f[n].line_total=i;f[n].tax_class=s});order_shipping=0;e("#shipping_rows").find("input[type=number], .wc_input_price").each(function(){cost=e(this).val()||"0";cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point);order_shipping+=parseFloat(cost)});var l={action:"woocommerce_calc_line_taxes",order_id:woocommerce_admin_meta_boxes.post_id,items:f,shipping:order_shipping,country:s,state:o,postcode:u,city:a,security:woocommerce_admin_meta_boxes.calc_totals_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,l,function(t){if(t){n.each(function(){var n=e(this),r=n.find("input.order_item_id").val();n.find(".edit_order_item").click();if(t.item_taxes[r]){n.find("input.line_tax").val(t.item_taxes[r].line_tax).change();n.find("input.line_subtotal_tax").val(t.item_taxes[r].line_subtotal_tax).change()}t.tax_row_html&&e("#tax_rows").empty().append(t.tax_row_html)});e("#tax_rows").find("input").change()}e(".woocommerce_order_items_wrapper").unblock()})}else e(".woocommerce_order_items_wrapper").unblock();return!1});e("button.calc_totals").click(function(){e("#woocommerce-order-totals").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t=confirm(woocommerce_admin_meta_boxes.calc_totals);if(t){var n=0,r=0,i=0,s=e("#_order_discount").val()||"0";s=accounting.unformat(s.replace(",","."));e("#shipping_rows").find("input[type=number], .wc_input_price").each(function(){cost=e(this).val()||"0";cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point);i+=parseFloat(cost)});e("#tax_rows").find("input[type=number], .wc_input_price").each(function(){cost=e(this).val()||"0";cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point);r+=parseFloat(cost)});e("#order_items_list tr.item, #order_items_list tr.fee").each(function(){line_total=e(this).find("input.line_total").val()||"0";n+=accounting.unformat(line_total.replace(",","."))});woocommerce_admin_meta_boxes.round_at_subtotal=="yes"&&(r=parseFloat(accounting.toFixed(r,woocommerce_admin_meta_boxes.rounding_precision)));e("#_order_total").val(accounting.formatNumber(n+r+i-s,woocommerce_admin_meta_boxes.currency_format_num_decimals,"",woocommerce_admin.mon_decimal_point)).change()}e("#woocommerce-order-totals").unblock();return!1});e("#woocommerce-order-items button.add_order_item").click(function(){var t=e("select#add_item_id").val();if(t){count=t.length;e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.each(t,function(t,n){var r={action:"woocommerce_add_order_item",item_to_add:n,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,r,function(t){e("table.woocommerce_order_items tbody#order_items_list").append(t);if(!--count){e("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","").val("");jQuery(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200});e("select#add_item_id").trigger("chosen:updated");e("table.woocommerce_order_items").unblock()}e("#order_items_list tr.new_row").trigger("init_row").removeClass("new_row")})})}else e("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","red");return!1});e("#woocommerce-order-items button.add_order_fee").click(function(){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t={action:"woocommerce_add_order_fee",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,t,function(t){e("table.woocommerce_order_items tbody#order_items_list").append(t);e("table.woocommerce_order_items").unblock()});return!1});e("#order_items_list").on("click","button.add_order_item_meta",function(){var t=e(this),n=t.closest("tr.item"),r={order_item_id:n.attr("data-order_item_id"),action:"woocommerce_add_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){n.find("tbody.meta_items").append(t);e("table.woocommerce_order_items").unblock()}});return!1});e("#order_items_list").on("click","button.remove_order_item_meta",function(){var t=confirm(woocommerce_admin_meta_boxes.remove_item_meta);if(t){var n=e(this).closest("tr"),r={meta_id:n.attr("data-meta_id"),action:"woocommerce_remove_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){n.hide();e("table.woocommerce_order_items").unblock()}})}return!1});e("#woocommerce-order-items").on("click","input.check-column",function(){e(this).is(":checked")?e("#woocommerce-order-items").find(".check-column input").attr("checked","checked"):e("#woocommerce-order-items").find(".check-column input").removeAttr("checked")});e("#woocommerce-order-items").on("click",".do_bulk_action",function(){var t=e(this).closest(".bulk_actions").find("select").val(),n=e("#woocommerce-order-items").find(".check-column input:checked"),r=[];e(n).each(function(){var t=e(this).closest("tr.item, tr.fee");r.push(t.attr("data-order_item_id"))});if(r.length==0){alert(woocommerce_admin_meta_boxes.i18n_select_items);return}if(t=="delete"){var i=confirm(woocommerce_admin_meta_boxes.remove_item_notice);if(i){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var s={order_item_ids:r,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce};e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:s,type:"POST",success:function(t){e(n).each(function(){e(this).closest("tr.item, tr.fee").remove()});e("table.woocommerce_order_items").unblock()}})}}else if(t=="reduce_stock"){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var o={};e(n).each(function(){var t=e(this).closest("tr.item, tr.fee"),n=t.find("input.quantity");o[t.attr("data-order_item_id")]=n.val()});var s={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:r,order_item_qty:o,action:"woocommerce_reduce_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:s,type:"POST",success:function(t){alert(t);e("table.woocommerce_order_items").unblock()}})}else if(t=="increase_stock"){e("table.woocommerce_order_items").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var o={};e(n).each(function(){var t=e(this).closest("tr.item, tr.fee"),n=t.find("input.quantity");o[t.attr("data-order_item_id")]=n.val()});var s={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:r,order_item_qty:o,action:"woocommerce_increase_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:s,type:"POST",success:function(t){alert(t);e("table.woocommerce_order_items").unblock()}})}return!1});e("button.load_customer_billing").click(function(){var t=confirm(woocommerce_admin_meta_boxes.load_billing);if(t){var n=e("#customer_user").val();if(!n){alert(woocommerce_admin_meta_boxes.no_customer_selected);return!1}var r={user_id:n,type_to_load:"billing",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};e(this).closest(".edit_address").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){var n=t;if(n){e("input#_billing_first_name").val(n.billing_first_name);e("input#_billing_last_name").val(n.billing_last_name);e("input#_billing_company").val(n.billing_company);e("input#_billing_address_1").val(n.billing_address_1);e("input#_billing_address_2").val(n.billing_address_2);e("input#_billing_city").val(n.billing_city);e("input#_billing_postcode").val(n.billing_postcode);e("#_billing_country").val(n.billing_country);e("input#_billing_state").val(n.billing_state);e("input#_billing_email").val(n.billing_email);e("input#_billing_phone").val(n.billing_phone)}e(".edit_address").unblock()}})}return!1});e("button.load_customer_shipping").click(function(){var t=confirm(woocommerce_admin_meta_boxes.load_shipping);if(t){var n=e("#customer_user").val();if(!n){alert(woocommerce_admin_meta_boxes.no_customer_selected);return!1}var r={user_id:n,type_to_load:"shipping",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};e(this).closest(".edit_address").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:r,type:"POST",success:function(t){var n=t;if(n){e("input#_shipping_first_name").val(n.shipping_first_name);e("input#_shipping_last_name").val(n.shipping_last_name);e("input#_shipping_company").val(n.shipping_company);e("input#_shipping_address_1").val(n.shipping_address_1);e("input#_shipping_address_2").val(n.shipping_address_2);e("input#_shipping_city").val(n.shipping_city);e("input#_shipping_postcode").val(n.shipping_postcode);e("#_shipping_country").val(n.shipping_country);e("input#_shipping_state").val(n.shipping_state)}e(".edit_address").unblock()}})}return!1});e("button.billing-same-as-shipping").click(function(){var t=confirm(woocommerce_admin_meta_boxes.copy_billing);if(t){e("input#_shipping_first_name").val(e("input#_billing_first_name").val());e("input#_shipping_last_name").val(e("input#_billing_last_name").val());e("input#_shipping_company").val(e("input#_billing_company").val());e("input#_shipping_address_1").val(e("input#_billing_address_1").val());e("input#_shipping_address_2").val(e("input#_billing_address_2").val());e("input#_shipping_city").val(e("input#_billing_city").val());e("input#_shipping_postcode").val(e("input#_billing_postcode").val());e("#_shipping_country").val(e("#_billing_country").val());e("input#_shipping_state").val(e("input#_billing_state").val())}return!1});e(".totals_group").on("click","a.add_total_row",function(){e(this).closest(".totals_group").find(".total_rows").append(e(this).data("row"));return!1});e(".total_rows").on("click","a.delete_total_row",function(){$row=e(this).closest(".total_row");var t=$row.attr("data-order_item_id");t?$row.append('').hide():$row.remove();return!1});e("select#product-type").change(function(){var n=e(this).val();if(n=="variable"){e("input#_manage_stock").change();e("input#_downloadable").prop("checked",!1);e("input#_virtual").removeAttr("checked")}else if(n=="grouped"){e("input#_downloadable").prop("checked",!1);e("input#_virtual").removeAttr("checked")}else if(n=="external"){e("input#_downloadable").prop("checked",!1);e("input#_virtual").removeAttr("checked")}t();e("ul.wc-tabs li:visible").eq(0).find("a").click();e("body").trigger("woocommerce-product-type-change",n,e(this))}).change();e("ul.wc-tabs li:visible").eq(0).find("a").click();e("input#_downloadable, input#_virtual").change(function(){t()});e(".sale_price_dates_fields").each(function(){var t=e(this),n=!1,r=t.closest("div, table");t.find("input").each(function(){e(this).val()!=""&&(n=!0)});if(n){r.find(".sale_schedule").hide();r.find(".sale_price_dates_fields").show()}else{r.find(".sale_schedule").show();r.find(".sale_price_dates_fields").hide()}});e("#woocommerce-product-data").on("click",".sale_schedule",function(){var t=e(this).closest("div, table");e(this).hide();t.find(".cancel_sale_schedule").show();t.find(".sale_price_dates_fields").show();return!1});e("#woocommerce-product-data").on("click",".cancel_sale_schedule",function(){var t=e(this).closest("div, table");e(this).hide();t.find(".sale_schedule").show();t.find(".sale_price_dates_fields").hide();t.find(".sale_price_dates_fields").find("input").val("");return!1});e(".downloadable_files").on("click","a.insert",function(){e(this).closest(".downloadable_files").find("tbody").append(e(this).data("row"));return!1});e(".downloadable_files").on("click","a.delete",function(){e(this).closest("tr").remove();return!1});e("input#_manage_stock").change(function(){e(this).is(":checked")?e("div.stock_fields").show():e("div.stock_fields").hide()}).change();var n=e(".sale_price_dates_fields input").datepicker({defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0,onSelect:function(t){var r=e(this).is("#_sale_price_dates_from, .sale_price_dates_from")?"minDate":"maxDate",i=e(this).data("datepicker"),s=e.datepicker.parseDate(i.settings.dateFormat||e.datepicker._defaults.dateFormat,t,i.settings);n.not(this).datepicker("option",r,s)}});e(".date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0});e(".date-picker-field").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0});jQuery(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(t){if(e(t.target).filter(":input, option").length)return;jQuery(this).next(".wc-metabox-content").toggle()}).on("click",".expand_all",function(e){jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > table").show();return!1}).on("click",".close_all",function(e){jQuery(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > table").hide();return!1});jQuery(".wc-metabox.closed").each(function(){jQuery(this).find(".wc-metabox-content").hide()});e(".product_attributes select.multiselect").chosen();var r=e(".product_attributes").find(".woocommerce_attribute").get();r.sort(function(t,n){var r=parseInt(e(t).attr("rel")),i=parseInt(e(n).attr("rel"));return ri?1:0});e(r).each(function(t,n){e(".product_attributes").append(n)});e("button.add_attribute").on("click",function(){var t=e(".product_attributes .woocommerce_attribute").size(),n=e("select.attribute_taxonomy").val();if(!n){var r=e("select#product-type").val();r!="variable"?enable_variation='style="display:none;"':enable_variation="";e(".product_attributes").append('")}else{var s=e(".product_attributes .woocommerce_attribute."+n);e(".product_attributes").append(e(s));e(s).show().find(".woocommerce_attribute_data").show();i()}e("select.attribute_taxonomy").val("")});e(".product_attributes").on("blur","input.attribute_name",function(){e(this).closest(".woocommerce_attribute").find("strong.attribute_name").text(e(this).val())});e(".product_attributes").on("click","button.select_all_attributes",function(){e(this).closest("td").find("select option").attr("selected","selected");e(this).closest("td").find("select").trigger("chosen:updated");return!1});e(".product_attributes").on("click","button.select_no_attributes",function(){e(this).closest("td").find("select option").removeAttr("selected");e(this).closest("td").find("select").trigger("chosen:updated");return!1});e(".product_attributes").on("click","button.remove_row",function(){var t=confirm(woocommerce_admin_meta_boxes.remove_attribute);if(t){var n=e(this).parent().parent();if(n.is(".taxonomy")){n.find("select, input[type=text]").val("");n.hide()}else{n.find("select, input[type=text]").val("");n.hide();i()}}return!1});e(".product_attributes").sortable({items:".woocommerce_attribute",cursor:"move",axis:"y",handle:"h3",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style");i()}});e(".product_attributes").on("click","button.add_new_attribute",function(){e(".product_attributes").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t=e(this).attr("data-attribute"),n=e(this).closest(".woocommerce_attribute_data"),r=prompt(woocommerce_admin_meta_boxes.new_attribute_prompt);if(r){var i={action:"woocommerce_add_new_attribute",taxonomy:t,term:r,security:woocommerce_admin_meta_boxes.add_attribute_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,i,function(t){if(t.error)alert(t.error);else if(t.slug){n.find("select.attribute_values").append('");n.find("select.attribute_values").trigger("chosen:updated")}e(".product_attributes").unblock()})}else e(".product_attributes").unblock();return!1});e(".save_attributes").on("click",function(){e(".product_attributes").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var t={post_id:woocommerce_admin_meta_boxes.post_id,data:e(".product_attributes").find("input, select, textarea").serialize(),action:"woocommerce_save_attributes",security:woocommerce_admin_meta_boxes.save_attributes_nonce};e.post(woocommerce_admin_meta_boxes.ajax_url,t,function(t){var n=window.location.toString();n=n.replace("post-new.php?","post.php?post="+woocommerce_admin_meta_boxes.post_id+"&action=edit&");e("#variable_product_options").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});e("#variable_product_options").load(n+" #variable_product_options_inner",function(){e("#variable_product_options").unblock()});e(".product_attributes").unblock()})});var s,o;jQuery(document).on("click",".upload_file_button",function(t){var n=e(this);o=n.closest("tr").find("td.file_url input");t.preventDefault();if(s){s.open();return}var r=[new wp.media.controller.Library({library:wp.media.query(),multiple:!0,title:n.data("choose"),priority:20,filterable:"uploaded"})];s=wp.media.frames.downloadable_file=wp.media({title:n.data("choose"),library:{type:""},button:{text:n.data("update")},multiple:!0,states:r});s.on("select",function(){var e="",t=s.state().get("selection");t.map(function(t){t=t.toJSON();t.url&&(e=t.url)});o.val(e)});s.on("ready",function(){s.uploader.options.uploader.params={type:"downloadable_product"}});s.open()});jQuery(".downloadable_files tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65})});
\ No newline at end of file
diff --git a/assets/js/admin/woocommerce_admin.js b/assets/js/admin/woocommerce_admin.js
index aa5d2aecffc..ceb29733f2f 100644
--- a/assets/js/admin/woocommerce_admin.js
+++ b/assets/js/admin/woocommerce_admin.js
@@ -3,24 +3,44 @@
*/
jQuery(function(){
- // Price input validation - Keep price inputs formatted correctly
- jQuery(".wc_input_decimal[type=text]")
- .each(function(){
- var value = jQuery(this).val();
- var newvalue = value.replace( '.', woocommerce_admin.locale_decimal_point );
- jQuery(this).val( newvalue );
+ // Price input validation
+ jQuery(".wc_input_decimal[type=text], .wc_input_price[type=text]")
+ .bind( 'blur', function() {
+ jQuery('.wc_error_tip').fadeOut('100', function(){ jQuery(this).remove(); } );
+ return this;
});
- jQuery(".wc_input_decimal[type=text]")
+
+ jQuery(".wc_input_price[type=text]")
.bind( 'keyup change', function() {
var value = jQuery(this).val();
- var regex = new RegExp( "[^0-9\%.\\" + woocommerce_admin.locale_decimal_point + "]+", "gi" );
+ var regex = new RegExp( "[^0-9\%.\\" + woocommerce_admin.mon_decimal_point + "]+", "gi" );
var newvalue = value.replace( regex, '' );
if ( value !== newvalue ) {
jQuery(this).val( newvalue );
if ( jQuery(this).parent().find('.wc_error_tip').size() == 0 ) {
var offset = jQuery(this).position();
- jQuery(this).after( '
' + woocommerce_admin.i18n_decimal_input_error + '
' );
+ jQuery(this).after( '' + woocommerce_admin.i18n_mon_decimal_error + '
' );
+ jQuery('.wc_error_tip')
+ .css('left', offset.left + jQuery(this).width() - ( jQuery(this).width() / 2 ) - ( jQuery('.wc_error_tip').width() / 2 ) )
+ .css('top', offset.top + jQuery(this).height() )
+ .fadeIn('100');
+ }
+ }
+ return this;
+ });
+
+ jQuery(".wc_input_decimal[type=text]")
+ .bind( 'keyup change', function() {
+ var value = jQuery(this).val();
+ var regex = new RegExp( "[^0-9\%.\\" + woocommerce_admin.decimal_point + "]+", "gi" );
+ var newvalue = value.replace( regex, '' );
+
+ if ( value !== newvalue ) {
+ jQuery(this).val( newvalue );
+ if ( jQuery(this).parent().find('.wc_error_tip').size() == 0 ) {
+ var offset = jQuery(this).position();
+ jQuery(this).after( '' + woocommerce_admin.i18n_decimal_error + '
' );
jQuery('.wc_error_tip')
.css('left', offset.left + jQuery(this).width() - ( jQuery(this).width() / 2 ) - ( jQuery('.wc_error_tip').width() / 2 ) )
.css('top', offset.top + jQuery(this).height() )
@@ -28,10 +48,6 @@ jQuery(function(){
}
}
return this;
- })
- .bind( 'blur', function() {
- jQuery('.wc_error_tip').fadeOut('100', function(){ jQuery(this).remove(); } );
- return this;
});
jQuery("body").click(function(){
diff --git a/assets/js/admin/woocommerce_admin.min.js b/assets/js/admin/woocommerce_admin.min.js
index c4f7e1250f6..88e3c3276a5 100644
--- a/assets/js/admin/woocommerce_admin.min.js
+++ b/assets/js/admin/woocommerce_admin.min.js
@@ -1,3 +1,3 @@
/**
* WooCommerce Admin JS
- */jQuery(function(){jQuery(".wc_input_decimal[type=text]").each(function(){var e=jQuery(this).val(),t=e.replace(".",woocommerce_admin.locale_decimal_point);jQuery(this).val(t)});jQuery(".wc_input_decimal[type=text]").bind("keyup change",function(){var e=jQuery(this).val(),t=new RegExp("[^0-9%.\\"+woocommerce_admin.locale_decimal_point+"]+","gi"),n=e.replace(t,"");if(e!==n){jQuery(this).val(n);if(jQuery(this).parent().find(".wc_error_tip").size()==0){var r=jQuery(this).position();jQuery(this).after(''+woocommerce_admin.i18n_decimal_input_error+"
");jQuery(".wc_error_tip").css("left",r.left+jQuery(this).width()-jQuery(this).width()/2-jQuery(".wc_error_tip").width()/2).css("top",r.top+jQuery(this).height()).fadeIn("100")}}return this}).bind("blur",function(){jQuery(".wc_error_tip").fadeOut("100",function(){jQuery(this).remove()});return this});jQuery("body").click(function(){jQuery(".wc_error_tip").fadeOut("100",function(){jQuery(this).remove()})});jQuery(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200});jQuery(".wc_input_table.sortable tbody").sortable({items:"tr",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")}});jQuery(".wc_input_table .remove_rows").click(function(){var e=jQuery(this).closest(".wc_input_table").find("tbody");if(e.find("tr.current").size()>0){$current=e.find("tr.current");$current.each(function(){jQuery(this).remove()})}return!1});var e=!1,t=!1,n=!1;jQuery(document).bind("keyup keydown",function(n){t=n.shiftKey;e=n.ctrlKey||n.metaKey});jQuery(".wc_input_table").on("focus click","input",function(r){$this_table=jQuery(this).closest("table");$this_row=jQuery(this).closest("tr");if(r.type=="focus"&&n!=$this_row.index()||r.type=="click"&&jQuery(this).is(":focus")){n=$this_row.index();if(!t&&!e){jQuery("tr",$this_table).removeClass("current").removeClass("last_selected");$this_row.addClass("current").addClass("last_selected")}else if(t){jQuery("tr",$this_table).removeClass("current");$this_row.addClass("selected_now").addClass("current");jQuery("tr.last_selected",$this_table).size()>0&&($this_row.index()>jQuery("tr.last_selected, $this_table").index()?jQuery("tr",$this_table).slice(jQuery("tr.last_selected",$this_table).index(),$this_row.index()).addClass("current"):jQuery("tr",$this_table).slice($this_row.index(),jQuery("tr.last_selected",$this_table).index()+1).addClass("current"));jQuery("tr",$this_table).removeClass("last_selected");$this_row.addClass("last_selected")}else{jQuery("tr",$this_table).removeClass("last_selected");e&&jQuery(this).closest("tr").is(".current")?$this_row.removeClass("current"):$this_row.addClass("current").addClass("last_selected")}jQuery("tr",$this_table).removeClass("selected_now")}}).on("blur","input",function(e){n=!1});jQuery("select.availability").change(function(){jQuery(this).val()=="all"?jQuery(this).closest("tr").next("tr").hide():jQuery(this).closest("tr").next("tr").show()}).change();jQuery("body").on("click",".show_order_items",function(){jQuery(this).closest("td").find("table").toggle();return!1});jQuery(".hide_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show()}).change()});jQuery(".show_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide()}).change()});jQuery("input#woocommerce_demo_store").change(function(){jQuery(this).is(":checked")?jQuery("#woocommerce_demo_store_notice").closest("tr").show():jQuery("#woocommerce_demo_store_notice").closest("tr").hide()}).change()});
\ No newline at end of file
+ */jQuery(function(){jQuery(".wc_input_decimal[type=text], .wc_input_price[type=text]").bind("blur",function(){jQuery(".wc_error_tip").fadeOut("100",function(){jQuery(this).remove()});return this});jQuery(".wc_input_price[type=text]").bind("keyup change",function(){var e=jQuery(this).val(),t=new RegExp("[^0-9%.\\"+woocommerce_admin.mon_decimal_point+"]+","gi"),n=e.replace(t,"");if(e!==n){jQuery(this).val(n);if(jQuery(this).parent().find(".wc_error_tip").size()==0){var r=jQuery(this).position();jQuery(this).after(''+woocommerce_admin.i18n_mon_decimal_error+"
");jQuery(".wc_error_tip").css("left",r.left+jQuery(this).width()-jQuery(this).width()/2-jQuery(".wc_error_tip").width()/2).css("top",r.top+jQuery(this).height()).fadeIn("100")}}return this});jQuery(".wc_input_decimal[type=text]").bind("keyup change",function(){var e=jQuery(this).val(),t=new RegExp("[^0-9%.\\"+woocommerce_admin.decimal_point+"]+","gi"),n=e.replace(t,"");if(e!==n){jQuery(this).val(n);if(jQuery(this).parent().find(".wc_error_tip").size()==0){var r=jQuery(this).position();jQuery(this).after(''+woocommerce_admin.i18n_decimal_error+"
");jQuery(".wc_error_tip").css("left",r.left+jQuery(this).width()-jQuery(this).width()/2-jQuery(".wc_error_tip").width()/2).css("top",r.top+jQuery(this).height()).fadeIn("100")}}return this});jQuery("body").click(function(){jQuery(".wc_error_tip").fadeOut("100",function(){jQuery(this).remove()})});jQuery(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200});jQuery(".wc_input_table.sortable tbody").sortable({items:"tr",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style")}});jQuery(".wc_input_table .remove_rows").click(function(){var e=jQuery(this).closest(".wc_input_table").find("tbody");if(e.find("tr.current").size()>0){$current=e.find("tr.current");$current.each(function(){jQuery(this).remove()})}return!1});var e=!1,t=!1,n=!1;jQuery(document).bind("keyup keydown",function(n){t=n.shiftKey;e=n.ctrlKey||n.metaKey});jQuery(".wc_input_table").on("focus click","input",function(r){$this_table=jQuery(this).closest("table");$this_row=jQuery(this).closest("tr");if(r.type=="focus"&&n!=$this_row.index()||r.type=="click"&&jQuery(this).is(":focus")){n=$this_row.index();if(!t&&!e){jQuery("tr",$this_table).removeClass("current").removeClass("last_selected");$this_row.addClass("current").addClass("last_selected")}else if(t){jQuery("tr",$this_table).removeClass("current");$this_row.addClass("selected_now").addClass("current");jQuery("tr.last_selected",$this_table).size()>0&&($this_row.index()>jQuery("tr.last_selected, $this_table").index()?jQuery("tr",$this_table).slice(jQuery("tr.last_selected",$this_table).index(),$this_row.index()).addClass("current"):jQuery("tr",$this_table).slice($this_row.index(),jQuery("tr.last_selected",$this_table).index()+1).addClass("current"));jQuery("tr",$this_table).removeClass("last_selected");$this_row.addClass("last_selected")}else{jQuery("tr",$this_table).removeClass("last_selected");e&&jQuery(this).closest("tr").is(".current")?$this_row.removeClass("current"):$this_row.addClass("current").addClass("last_selected")}jQuery("tr",$this_table).removeClass("selected_now")}}).on("blur","input",function(e){n=!1});jQuery("select.availability").change(function(){jQuery(this).val()=="all"?jQuery(this).closest("tr").next("tr").hide():jQuery(this).closest("tr").next("tr").show()}).change();jQuery("body").on("click",".show_order_items",function(){jQuery(this).closest("td").find("table").toggle();return!1});jQuery(".hide_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show()}).change()});jQuery(".show_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide()}).change()});jQuery("input#woocommerce_demo_store").change(function(){jQuery(this).is(":checked")?jQuery("#woocommerce_demo_store_notice").closest("tr").show():jQuery("#woocommerce_demo_store_notice").closest("tr").hide()}).change()});
\ No newline at end of file
diff --git a/includes/abstracts/abstract-wc-settings-api.php b/includes/abstracts/abstract-wc-settings-api.php
index b5fe0e83b8b..a918f26c715 100644
--- a/includes/abstracts/abstract-wc-settings-api.php
+++ b/includes/abstracts/abstract-wc-settings-api.php
@@ -3,7 +3,7 @@
* Admin Settings API used by Shipping Methods and Payment Gateways
*
* @class WC_Settings_API
- * @version 2.0.0
+ * @version 2.1.0
* @package WooCommerce/Abstracts
* @category Abstract Class
* @author WooThemes
@@ -45,7 +45,6 @@ abstract class WC_Settings_API {
settings ) )
$this->init_settings();
@@ -150,7 +144,6 @@ abstract class WC_Settings_API {
return $this->settings[ $key ];
}
-
/**
* Decode values for settings.
*
@@ -159,10 +152,9 @@ abstract class WC_Settings_API {
* @return array
*/
public function format_settings( $value ) {
- return ( is_array( $value ) ) ? $value : $value;
+ return is_array( $value ) ? $value : $value;
}
-
/**
* Generate Settings HTML.
*
@@ -175,11 +167,9 @@ abstract class WC_Settings_API {
* @access public
* @return string the html for the settings
*/
- public function generate_settings_html ( $form_fields = false ) {
-
- if ( ! $form_fields ) {
+ public function generate_settings_html( $form_fields = false ) {
+ if ( ! $form_fields )
$form_fields = $this->form_fields;
- }
$html = '';
foreach ( $form_fields as $k => $v ) {
@@ -196,6 +186,56 @@ abstract class WC_Settings_API {
echo $html;
}
+ /**
+ * Get HTML for tooltips
+ * @param array $data
+ * @return string
+ */
+ public function get_tooltip_html( $data ) {
+ if ( $data['desc_tip'] === true ) {
+ $tip = $data['description'];
+ } elseif ( ! empty( $data['desc_tip'] ) ) {
+ $tip = $data['desc_tip'];
+ } else {
+ $tip = '';
+ }
+
+ return $tip ? '' : '';
+ }
+
+ /**
+ * Get HTML for descriptions
+ * @param array $data
+ * @return string
+ */
+ public function get_description_html( $data ) {
+ if ( $data['desc_tip'] === true ) {
+ $description = '';
+ } elseif ( ! empty( $data['desc_tip'] ) ) {
+ $description = $data['description'];
+ } elseif ( ! empty( $data['description'] ) ) {
+ $description = $data['description'];
+ } else {
+ $description = '';
+ }
+
+ return $description ? '' . wp_kses_post( $description ) . '
' . "\n" : '';
+ }
+
+ /**
+ * Get custom attributes
+ * @param array $data
+ * @return string
+ */
+ public function get_custom_attribute_html( $data ) {
+ $custom_attributes = array();
+
+ if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
+ foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
+ $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
+
+ return implode( ' ', $custom_attributes );
+ }
/**
* Generate Text Input HTML.
@@ -207,60 +247,126 @@ abstract class WC_Settings_API {
* @return string
*/
public function generate_text_html( $key, $data ) {
- global $woocommerce;
+ $field = $this->plugin_id . $this->id . '_' . $key;
+ $defaults = array(
+ 'title' => '',
+ 'disabled' => false,
+ 'class' => '',
+ 'css' => '',
+ 'placeholder' => '',
+ 'type' => 'text',
+ 'desc_tip' => false,
+ 'description' => '',
+ 'custom_attributes' => array()
+ );
- $html = '';
+ $data = wp_parse_args( $data, $defaults );
- $data['title'] = isset( $data['title'] ) ? $data['title'] : '';
- $data['disabled'] = empty( $data['disabled'] ) ? false : true;
- $data['class'] = isset( $data['class'] ) ? $data['class'] : '';
- $data['css'] = isset( $data['css'] ) ? $data['css'] : '';
- $data['placeholder'] = isset( $data['placeholder'] ) ? $data['placeholder'] : '';
- $data['type'] = isset( $data['type'] ) ? $data['type'] : 'text';
- $data['desc_tip'] = isset( $data['desc_tip'] ) ? $data['desc_tip'] : false;
- $data['description'] = isset( $data['description'] ) ? $data['description'] : '';
+ ob_start();
+ ?>
+
+
+
+ get_tooltip_html( $data ); ?>
+ |
+
+
+ |
+
+ plugin_id . $this->id . '_' . $key;
+ $defaults = array(
+ 'title' => '',
+ 'disabled' => false,
+ 'class' => '',
+ 'css' => '',
+ 'placeholder' => '',
+ 'type' => 'text',
+ 'desc_tip' => false,
+ 'description' => '',
+ 'custom_attributes' => array()
+ );
- // Custom attribute handling
- $custom_attributes = array();
+ $data = wp_parse_args( $data, $defaults );
- if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
- foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
+ ob_start();
+ ?>
+
+
+
+ get_tooltip_html( $data ); ?>
+ |
+
+
+ |
+
+ ' . "\n";
- $html .= '';
- $html .= '';
+ /**
+ * Generate Password Input HTML.
+ *
+ * @access public
+ * @param mixed $key
+ * @param mixed $data
+ * @since 1.0.0
+ * @return string
+ */
+ public function generate_decimal_html( $key, $data ) {
+ $field = $this->plugin_id . $this->id . '_' . $key;
+ $defaults = array(
+ 'title' => '',
+ 'disabled' => false,
+ 'class' => '',
+ 'css' => '',
+ 'placeholder' => '',
+ 'type' => 'text',
+ 'desc_tip' => false,
+ 'description' => '',
+ 'custom_attributes' => array()
+ );
- if ( $tip )
- $html .= '';
+ $data = wp_parse_args( $data, $defaults );
- $html .= ' | ' . "\n";
- $html .= '' . "\n";
- $html .= '';
- $html .= ' | ' . "\n";
- $html .= '' . "\n";
-
- return $html;
+ ob_start();
+ ?>
+
+
+
+ get_tooltip_html( $data ); ?>
+ |
+
+
+ |
+
+ $attribute_value )
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
-
- $html .= '' . "\n";
- $html .= '';
- $html .= '';
-
- if ( $tip )
- $html .= '';
-
- $html .= ' | ' . "\n";
- $html .= '' . "\n";
- $html .= '';
- $html .= ' | ' . "\n";
- $html .= '
' . "\n";
-
- return $html;
+ $data['type'] = 'password';
+ return $this->generate_text_html( $key, $data );
}
/**
@@ -337,59 +393,38 @@ abstract class WC_Settings_API {
* @return string
*/
public function generate_textarea_html( $key, $data ) {
- global $woocommerce;
+ $field = $this->plugin_id . $this->id . '_' . $key;
+ $defaults = array(
+ 'title' => '',
+ 'disabled' => false,
+ 'class' => '',
+ 'css' => '',
+ 'placeholder' => '',
+ 'type' => 'text',
+ 'desc_tip' => false,
+ 'description' => '',
+ 'custom_attributes' => array()
+ );
- $html = '';
+ $data = wp_parse_args( $data, $defaults );
- $data['title'] = isset( $data['title'] ) ? $data['title'] : '';
- $data['disabled'] = empty( $data['disabled'] ) ? false : true;
- $data['class'] = isset( $data['class'] ) ? $data['class'] : '';
- $data['css'] = isset( $data['css'] ) ? $data['css'] : '';
- $data['desc_tip'] = isset( $data['desc_tip'] ) ? $data['desc_tip'] : false;
- $data['description'] = isset( $data['description'] ) ? $data['description'] : '';
- $data['placeholder'] = isset( $data['placeholder'] ) ? $data['placeholder'] : '';
-
- // Description handling
- if ( $data['desc_tip'] === true ) {
- $description = '';
- $tip = $data['description'];
- } elseif ( ! empty( $data['desc_tip'] ) ) {
- $description = $data['description'];
- $tip = $data['desc_tip'];
- } elseif ( ! empty( $data['description'] ) ) {
- $description = $data['description'];
- $tip = '';
- } else {
- $description = $tip = '';
- }
-
- // Custom attribute handling
- $custom_attributes = array();
-
- if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
- foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
-
- $html .= '' . "\n";
- $html .= '';
- $html .= '';
-
- if ( $tip )
- $html .= '';
-
- $html .= ' | ' . "\n";
- $html .= '' . "\n";
- $html .= '';
- $html .= ' | ' . "\n";
- $html .= '
' . "\n";
-
- return $html;
+ ob_start();
+ ?>
+
+
+
+ get_tooltip_html( $data ); ?>
+ |
+
+
+ |
+
+ plugin_id . $this->id . '_' . $key;
+ $defaults = array(
+ 'title' => '',
+ 'label' => '',
+ 'disabled' => false,
+ 'class' => '',
+ 'css' => '',
+ 'type' => 'text',
+ 'desc_tip' => false,
+ 'description' => '',
+ 'custom_attributes' => array()
+ );
- $html = '';
+ $data = wp_parse_args( $data, $defaults );
- $data['title'] = isset( $data['title'] ) ? $data['title'] : '';
- $data['label'] = isset( $data['label'] ) ? $data['label'] : $data['title'];
- $data['disabled'] = empty( $data['disabled'] ) ? false : true;
- $data['class'] = isset( $data['class'] ) ? $data['class'] : '';
- $data['css'] = isset( $data['css'] ) ? $data['css'] : '';
- $data['desc_tip'] = isset( $data['desc_tip'] ) ? $data['desc_tip'] : false;
- $data['description'] = isset( $data['description'] ) ? $data['description'] : '';
+ if ( ! $data['label'] )
+ $data['label'] = $data['title'];
- // Description handling
- if ( $data['desc_tip'] === true ) {
- $description = '';
- $tip = $data['description'];
- } elseif ( ! empty( $data['desc_tip'] ) ) {
- $description = $data['description'];
- $tip = $data['desc_tip'];
- } elseif ( ! empty( $data['description'] ) ) {
- $description = $data['description'];
- $tip = '';
- } else {
- $description = $tip = '';
- }
-
- // Custom attribute handling
- $custom_attributes = array();
-
- if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
- foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
-
- $html .= '' . "\n";
- $html .= '' . $data['title'];
-
- if ( $tip )
- $html .= '';
-
- $html .= ' | ' . "\n";
- $html .= '' . "\n";
- $html .= '';
- $html .= ' | ' . "\n";
- $html .= '
' . "\n";
-
- return $html;
+ ob_start();
+ ?>
+
+
+
+ get_tooltip_html( $data ); ?>
+ |
+
+
+ |
+
+ plugin_id . $this->id . '_' . $key;
+ $defaults = array(
+ 'title' => '',
+ 'disabled' => false,
+ 'class' => '',
+ 'css' => '',
+ 'placeholder' => '',
+ 'type' => 'text',
+ 'desc_tip' => false,
+ 'description' => '',
+ 'custom_attributes' => array(),
+ 'options' => array()
+ );
- $html = '';
+ $data = wp_parse_args( $data, $defaults );
- $data['title'] = isset( $data['title'] ) ? $data['title'] : '';
- $data['disabled'] = empty( $data['disabled'] ) ? false : true;
- $data['options'] = isset( $data['options'] ) ? (array) $data['options'] : array();
- $data['class'] = isset( $data['class'] ) ? $data['class'] : '';
- $data['css'] = isset( $data['css'] ) ? $data['css'] : '';
- $data['desc_tip'] = isset( $data['desc_tip'] ) ? $data['desc_tip'] : false;
- $data['description'] = isset( $data['description'] ) ? $data['description'] : '';
-
- // Description handling
- if ( $data['desc_tip'] === true ) {
- $description = '';
- $tip = $data['description'];
- } elseif ( ! empty( $data['desc_tip'] ) ) {
- $description = $data['description'];
- $tip = $data['desc_tip'];
- } elseif ( ! empty( $data['description'] ) ) {
- $description = $data['description'];
- $tip = '';
- } else {
- $description = $tip = '';
- }
-
- // Custom attribute handling
- $custom_attributes = array();
-
- if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
- foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
-
- $html .= '' . "\n";
- $html .= '';
- $html .= '';
-
- if ( $tip )
- $html .= '';
-
- $html .= ' | ' . "\n";
- $html .= '' . "\n";
- $html .= '';
- $html .= ' | ' . "\n";
- $html .= '
' . "\n";
-
- return $html;
+ ob_start();
+ ?>
+
+
+
+ get_tooltip_html( $data ); ?>
+ |
+
+
+ |
+
+ plugin_id . $this->id . '_' . $key;
+ $defaults = array(
+ 'title' => '',
+ 'disabled' => false,
+ 'class' => '',
+ 'placeholder' => '',
+ 'type' => 'text',
+ 'desc_tip' => false,
+ 'description' => '',
+ 'custom_attributes' => array(),
+ 'options' => array()
+ );
- $html = '';
+ $data = wp_parse_args( $data, $defaults );
- $data['title'] = isset( $data['title'] ) ? $data['title'] : '';
- $data['disabled'] = empty( $data['disabled'] ) ? false : true;
- $data['options'] = isset( $data['options'] ) ? (array) $data['options'] : array();
- $data['class'] = isset( $data['class'] ) ? $data['class'] : '';
- $data['css'] = isset( $data['css'] ) ? $data['css'] : '';
- $data['desc_tip'] = isset( $data['desc_tip'] ) ? $data['desc_tip'] : false;
- $data['description'] = isset( $data['description'] ) ? $data['description'] : '';
-
- // Description handling
- if ( $data['desc_tip'] === true ) {
- $description = '';
- $tip = $data['description'];
- } elseif ( ! empty( $data['desc_tip'] ) ) {
- $description = $data['description'];
- $tip = $data['desc_tip'];
- } elseif ( ! empty( $data['description'] ) ) {
- $description = $data['description'];
- $tip = '';
- } else {
- $description = $tip = '';
- }
-
- // Custom attribute handling
- $custom_attributes = array();
-
- if ( ! empty( $data['custom_attributes'] ) && is_array( $data['custom_attributes'] ) )
- foreach ( $data['custom_attributes'] as $attribute => $attribute_value )
- $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
-
- $html .= '' . "\n";
- $html .= '';
- $html .= '';
-
- if ( $tip )
- $html .= '';
-
- $html .= ' | ' . "\n";
- $html .= '' . "\n";
- $html .= '';
- $html .= ' | ' . "\n";
- $html .= '
' . "\n";
-
- return $html;
+ ob_start();
+ ?>
+
+
+
+ get_tooltip_html( $data ); ?>
+ |
+
+
+ |
+
+ '',
+ 'class' => '',
+ 'css' => ''
+ );
- $data['title'] = isset( $data['title'] ) ? $data['title'] : '';
- $data['class'] = isset( $data['class'] ) ? $data['class'] : '';
- $data['css'] = isset( $data['css'] ) ? $data['css'] : '';
+ $data = wp_parse_args( $data, $defaults );
- $html .= '' . "\n";
- $html .= '' . wp_kses_post( $data['title'] ) . '
' . "\n";
- if ( isset( $data['description'] ) && $data['description'] != '' ) { $html .= '' . wp_kses_post( $data['description'] ) . '
' . "\n"; }
- $html .= '
+
+
+
+
+