diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index f5560e10fbe..f44d6d8be73 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -21,6 +21,20 @@ jQuery( function ( $ ) { $( '#woocommerce-order-items' ).unblock(); } + /** + * Run TipTip + */ + function runTipTip() { + $( '#tiptip_holder' ).removeAttr( 'style' ); + $( '#tiptip_arrow' ).removeAttr( 'style' ); + $( '.tips' ).tipTip({ + 'attribute': 'data-tip', + 'fadeIn': 50, + 'fadeOut': 50, + 'delay': 200 + }); + } + /** * Load order items * @@ -42,6 +56,7 @@ jQuery( function ( $ ) { success: function( response ) { $( '#woocommerce-order-items .inside' ).empty(); $( '#woocommerce-order-items .inside' ).append( response ); + runTipTip(); removeOrderItemsLoading(); } }); @@ -541,6 +556,7 @@ jQuery( function ( $ ) { success: function( response ) { $( '#woocommerce-order-items .inside' ).empty(); $( '#woocommerce-order-items .inside' ).append( response ); + runTipTip(); removeOrderItemsLoading(); } }); @@ -744,16 +760,7 @@ jQuery( function ( $ ) { if ( !--count ) { $( 'select#add_item_id, #add_item_id_chosen .chosen-choices' ).css( 'border-color', '' ).val( '' ); - - $( '#tiptip_holder' ).removeAttr( 'style' ); - $( '#tiptip_arrow' ).removeAttr( 'style' ); - $( '.tips' ).tipTip({ - 'attribute': 'data-tip', - 'fadeIn': 50, - 'fadeOut': 50, - 'delay': 200 - }); - + runTipTip(); $( 'select#add_item_id' ).trigger( 'chosen:updated' ); removeOrderItemsLoading(); } diff --git a/assets/js/admin/meta-boxes-order.min.js b/assets/js/admin/meta-boxes-order.min.js index 87e86d91d94..9d520172248 100644 --- a/assets/js/admin/meta-boxes-order.min.js +++ b/assets/js/admin/meta-boxes-order.min.js @@ -1 +1 @@ -jQuery(function(a){function b(){a("#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}})}function c(){a("#woocommerce-order-items").unblock()}function d(){var d={order_id:woocommerce_admin_meta_boxes.post_id,action:"woocommerce_load_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:d,type:"POST",success:function(b){a("#woocommerce-order-items .inside").empty(),a("#woocommerce-order-items .inside").append(b),c()}})}a("#woocommerce-order-actions input, #woocommerce-order-actions a").click(function(){window.onbeforeunload=""}),a("a.edit_address").click(function(b){b.preventDefault(),a(this).hide(),a(this).closest(".order_data_column").find("div.address").hide(),a(this).closest(".order_data_column").find("div.edit_address").show()}),a("#order_items_list tr.item, #order_items_list tr.fee").each(function(){a(this).trigger("init_row"),a(this).find(".edit").hide()}),a("body").on("init_row","#order_items_list tr.item",function(){var b=a(this),c=b.find("input.quantity"),d=c.val(),e=accounting.unformat(b.find("input.line_subtotal").val(),woocommerce_admin.mon_decimal_point),f=accounting.unformat(b.find("input.line_total").val(),woocommerce_admin.mon_decimal_point),g=accounting.unformat(b.find("input.line_tax").val(),woocommerce_admin.mon_decimal_point),h=accounting.unformat(b.find("input.line_subtotal_tax").val(),woocommerce_admin.mon_decimal_point);d?(unit_subtotal=parseFloat(accounting.toFixed(e/d,woocommerce_admin_meta_boxes.rounding_precision)),unit_subtotal_tax=parseFloat(accounting.toFixed(h/d,woocommerce_admin_meta_boxes.rounding_precision)),unit_total=parseFloat(accounting.toFixed(f/d,woocommerce_admin_meta_boxes.rounding_precision)),unit_total_tax=parseFloat(accounting.toFixed(g/d,woocommerce_admin_meta_boxes.rounding_precision))):unit_subtotal=unit_subtotal_tax=unit_total=unit_total_tax=0,c.attr("data-o_qty",d),b.attr("data-unit_subtotal",unit_subtotal),b.attr("data-unit_subtotal_tax",unit_subtotal_tax),b.attr("data-unit_total",unit_total),b.attr("data-unit_total_tax",unit_total_tax)}).on("init_row","#order_items_list tr.fee",function(){var b=a(this),c=accounting.unformat(b.find("input.line_total").val(),woocommerce_admin.mon_decimal_point),d=accounting.unformat(b.find("input.line_tax").val(),woocommerce_admin.mon_decimal_point);unit_total=parseFloat(accounting.toFixed(c,woocommerce_admin_meta_boxes.rounding_precision)),unit_total_tax=parseFloat(accounting.toFixed(d,woocommerce_admin_meta_boxes.rounding_precision)),b.attr("data-unit_total",unit_total),b.attr("data-unit_total_tax",unit_total_tax)}).on("click","a.edit-order-item",function(){return a(this).closest("tr").find(".view").hide(),a(this).closest("tr").find(".edit").show(),a(this).hide(),a("button.add-line-item").click(),a("button.cancel-action").attr("data-reload",!0),!1}).on("click","#order_items_list a.delete-order-item",function(){var d=window.confirm(woocommerce_admin_meta_boxes.remove_item_notice);if(d){var e=a(this).closest("tr.item, tr.fee, tr.shipping"),f=e.attr("data-order_item_id");b();var g={order_item_ids:f,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:g,type:"POST",success:function(){e.remove(),c()}})}return!1}).on("click","#order_items_list .delete_refund",function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_refund)){var c=a(this).closest("tr.refund"),e=c.attr("data-order_refund_id");b();var f={action:"woocommerce_delete_refund",refund_id:e,security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:f,type:"POST",success:function(){d()}})}return!1}).on("change","#order_items_list input.quantity",function(){var b=a(this).closest("tr.item"),c=a(this).val(),d=b.attr("data-unit_subtotal"),e=b.attr("data-unit_subtotal_tax"),f=b.attr("data-unit_total"),g=b.attr("data-unit_total_tax"),h=(a(this).attr("data-o_qty"),parseFloat(accounting.formatNumber(d*c,woocommerce_admin_meta_boxes.rounding_precision,""))),i=parseFloat(accounting.formatNumber(e*c,woocommerce_admin_meta_boxes.rounding_precision,"")),j=parseFloat(accounting.formatNumber(f*c,woocommerce_admin_meta_boxes.rounding_precision,"")),k=parseFloat(accounting.formatNumber(g*c,woocommerce_admin_meta_boxes.rounding_precision,""));h=h.toString().replace(".",woocommerce_admin.mon_decimal_point),i=i.toString().replace(".",woocommerce_admin.mon_decimal_point),j=j.toString().replace(".",woocommerce_admin.mon_decimal_point),k=k.toString().replace(".",woocommerce_admin.mon_decimal_point),b.find("input.line_subtotal").val(h),b.find("input.line_total").val(j),b.find("input.line_subtotal_tax").val(i),b.find("input.line_tax").val(k),a(this).trigger("quantity_changed")}).on("change","#order_items_list input.line_subtotal",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_subtotal",e)}).on("change","#order_items_list input.line_total",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_total",e)}).on("change","#order_items_list input.line_subtotal_tax",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_subtotal_tax",e)}).on("change","#order_items_list input.line_tax",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_total_tax",e)}).on("change","#order_items_list .wc-order-item-refund-quantity input",function(){var b=0,c=a("#order_items_list").find("tr.item, tr.fee");c.each(function(){var c=a(this),d=c.find(".wc-order-item-refund-quantity input").val();d&&(b=parseFloat(b)+d*(parseFloat(c.attr("data-unit_total"))+parseFloat(c.attr("data-unit_total_tax"))))}),a("#refund_amount").val(b).change()}).on("click","#order_items_list button.add_order_item_meta",function(){var d=a(this),e=d.closest("tr.item"),f={order_item_id:e.attr("data-order_item_id"),action:"woocommerce_add_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};return b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:f,type:"POST",success:function(a){e.find("tbody.meta_items").append(a),c()}}),!1}).on("click","#order_items_list button.remove_order_item_meta",function(){var d=confirm(woocommerce_admin_meta_boxes.remove_item_meta);if(d){var e=a(this).closest("tr"),f={meta_id:e.attr("data-meta_id"),action:"woocommerce_remove_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:f,type:"POST",success:function(){e.hide(),c()}})}return!1}),a("#woocommerce-order-items").on("click","button.add-line-item",function(){return a("div.wc-order-add-item").slideDown(),a("div.wc-order-bulk-actions").slideUp(),!1}).on("click","button.refund-items",function(){return a("div.wc-order-refund-items").slideDown(),a("div.wc-order-bulk-actions").slideUp(),a("div.wc-order-totals-items").slideUp(),a(".wc-order-item-refund-quantity").show(),a(".wc-order-edit-line-item").hide(),!1}).on("click",".cancel-action",function(){return a(this).closest("div.wc-order-data-row").slideUp(),a("div.wc-order-bulk-actions").slideDown(),a("div.wc-order-totals-items").slideDown(),a(".wc-order-item-refund-quantity").hide(),a(".wc-order-edit-line-item").show(),"true"===a(this).attr("data-reload")&&d(),!1}).on("click","button.add-order-item",function(){return void 0===window.WCBackbone.Modal.__instance&&(window.WCBackbone.Modal.__instance=new WCBackbone.Modal.View({target:"#wc-modal-add-products"})),!1}).on("click","button.add-order-fee",function(){b();var d={action:"woocommerce_add_order_fee",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,d,function(b){a("table.woocommerce_order_items tbody#order_items_list").append(b),c()}),!1}).on("click","button.add-order-shipping",function(){b();var d={action:"woocommerce_add_order_shipping",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,d,function(b){a("table.woocommerce_order_items tbody#order_items_list").append(b),c()}),!1}).on("click","input.check-column",function(){a(this).is(":checked")?a("#woocommerce-order-items").find(".check-column input").attr("checked","checked"):a("#woocommerce-order-items").find(".check-column input").removeAttr("checked")}).on("click",".do_bulk_action",function(){var d=a(this).closest(".bulk-actions").find("select").val(),e=a("#woocommerce-order-items").find(".check-column input:checked"),f=[];if(a(e).each(function(){var b=a(this).closest("tr.item, tr.fee");f.push(b.attr("data-order_item_id"))}),0==f.length)return void alert(woocommerce_admin_meta_boxes.i18n_select_items);if("delete"==d){var g=confirm(woocommerce_admin_meta_boxes.remove_item_notice);if(g){b();var h={order_item_ids:f,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:h,type:"POST",success:function(){a(e).each(function(){a(this).closest("tr.item, tr.fee").remove()}),c()}})}}else if("reduce_stock"==d){b();var i={};a(e).each(function(){var b=a(this).closest("tr.item, tr.fee"),c=b.find("input.quantity");i[b.attr("data-order_item_id")]=c.val()});var h={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:f,order_item_qty:i,action:"woocommerce_reduce_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:h,type:"POST",success:function(a){alert(a),c()}})}else if("increase_stock"==d){b();var i={};a(e).each(function(){var b=a(this).closest("tr.item, tr.fee"),c=b.find("input.quantity");i[b.attr("data-order_item_id")]=c.val()});var h={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:f,order_item_qty:i,action:"woocommerce_increase_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:h,type:"POST",success:function(a){alert(a),c()}})}return!1}).on("click","button.calculate-action",function(){if(window.confirm(woocommerce_admin_meta_boxes.calc_totals)){b();var c=0,d=0,e=0,f=a("#_order_discount").val()||"0";f=accounting.unformat(f.replace(",",".")),a("#order_items_list tr.item, #order_items_list tr.shipping .wc_input_price").each(function(){cost=a(this).val()||"0",cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point),e+=parseFloat(cost)}),a("#tax_rows").find("input[type=number], .wc_input_price").each(function(){cost=a(this).val()||"0",cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point),d+=parseFloat(cost)}),a("#order_items_list tr.item, #order_items_list tr.fee").each(function(){line_total=a(this).find("input.line_total").val()||"0",c+=accounting.unformat(line_total.replace(",","."))}),"yes"===woocommerce_admin_meta_boxes.round_at_subtotal&&(d=parseFloat(accounting.toFixed(d,woocommerce_admin_meta_boxes.rounding_precision))),a("#_order_total").val(accounting.formatNumber(c+d+e-f,woocommerce_admin_meta_boxes.currency_format_num_decimals,"",woocommerce_admin.mon_decimal_point)).change(),a("button.save-action").click()}return!1}).on("click","button.save-action",function(){var d={order_id:woocommerce_admin_meta_boxes.post_id,items:a("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize(),action:"woocommerce_save_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};return b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:d,type:"POST",success:function(b){a("#woocommerce-order-items .inside").empty(),a("#woocommerce-order-items .inside").append(b),c()}}),!1}),a("body").on("change",".wc-order-refund-items #refund_amount",function(){a("button .wc-order-refund-amount .amount").text(accounting.formatMoney(a(this).val(),{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}))}).on("click",".wc-order-refund-items button.do-api-refund, .wc-order-refund-items button.do-manual-refund",function(){if(b(),window.confirm(woocommerce_admin_meta_boxes.i18n_do_refund)){var e=a("input#refund_amount").val(),f=a("input#refund_reason").val(),g=a.map(a("input[type=number][name^=order_item_refund_qty]"),function(b){var c=[];return c.push(a(b).closest("tr.item,tr.fee").data("order_item_id"),b.value),c}),h={action:"woocommerce_refund_line_items",order_id:woocommerce_admin_meta_boxes.post_id,refund_amount:e,refund_reason:f,refund_qty:JSON.stringify(g,null,""),api_refund:a(this).is(".do-api-refund"),security:woocommerce_admin_meta_boxes.order_item_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,h,function(a){a===!0?d():a.error&&(window.alert(a.error),c())})}else c()}),a("#woocommerce-order-totals").on("change input",".order_taxes_amount, .order_taxes_shipping_amount, .shipping_cost, #_order_discount",function(){var b=a(this),c=b.closest(".totals_group").find("input[type=number], .wc_input_price"),d=0;c.each(function(){a(this).val()&&(d+=accounting.unformat(a(this).val(),woocommerce_admin.mon_decimal_point))}),(b.is(".order_taxes_amount")||b.is(".order_taxes_shipping_amount"))&&(d=round(d,woocommerce_admin_meta_boxes.currency_format_num_decimals,woocommerce_admin_meta_boxes.tax_rounding_mode));var e=accounting.formatMoney(d,{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});b.closest(".totals_group").find("span.inline_total").text(e)}).on("click","button.calc_line_taxes",function(){a(".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 b=confirm(woocommerce_admin_meta_boxes.calc_line_taxes);if(b){var c=a("#order_items_list").find("tr.item, tr.fee"),d=a("#_shipping_country").val(),e=a("#_billing_country").val();if(d)var f=d,g=a("#_shipping_state").val(),h=a("#_shipping_postcode").val(),i=a("#_shipping_city").val();else if(e)var f=e,g=a("#_billing_state").val(),h=a("#_billing_postcode").val(),i=a("#_billing_city").val();else var f=woocommerce_admin_meta_boxes.base_country,g="",h="",i="";var j={};c.each(function(){var b=a(this),c=b.find("input.order_item_id").val(),d=b.find("input.line_subtotal").val(),e=b.find("input.line_total").val(),f=b.find("select.tax_class").val();j[c]={},j[c].line_subtotal=d,j[c].line_total=e,j[c].tax_class=f}),order_shipping=0,a("#shipping_rows").find("input[type=number], .wc_input_price").each(function(){cost=a(this).val()||"0",cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point),order_shipping+=parseFloat(cost)});var k={action:"woocommerce_calc_line_taxes",order_id:woocommerce_admin_meta_boxes.post_id,items:j,shipping:order_shipping,country:f,state:g,postcode:h,city:i,security:woocommerce_admin_meta_boxes.calc_totals_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,k,function(b){b&&(c.each(function(){var c=a(this),d=c.find("input.order_item_id").val();c.find(".edit-order-item").click(),b.item_taxes[d]&&(c.find("input.line_tax").val(b.item_taxes[d].line_tax).change(),c.find("input.line_subtotal_tax").val(b.item_taxes[d].line_subtotal_tax).change()),b.tax_row_html&&a("#tax_rows").empty().append(b.tax_row_html)}),a("#tax_rows").find("input").change()),a(".woocommerce_order_items_wrapper").unblock()})}else a(".woocommerce_order_items_wrapper").unblock();return!1}),a("body").on("wc_backbone_modal_response",function(d,e){if("#wc-modal-add-products"===e){var f=a("select#add_item_id").val();f?(count=f.length,b(),a.each(f,function(b,d){var e={action:"woocommerce_add_order_item",item_to_add:d,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,e,function(b){a("table.woocommerce_order_items tbody#order_items_list").append(b),--count||(a("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","").val(""),a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a("select#add_item_id").trigger("chosen:updated"),c()),a("#order_items_list tr.new_row").trigger("init_row").removeClass("new_row")})})):a("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","red")}}),a("span.inline_total").closest(".totals_group").find("input").change(),a(".order_download_permissions").on("click","button.grant_access",function(){var b=a("select#grant_access_id").val();if(b){a(".order_download_permissions").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var c={action:"woocommerce_grant_access_to_download",product_ids:b,loop:a(".order_download_permissions .wc-metabox").size(),order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.grant_access_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,c,function(b){b?a(".order_download_permissions .wc-metaboxes").append(b):alert(woocommerce_admin_meta_boxes.i18n_download_permission_fail),a(".date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0}),a("#grant_access_id").val("").trigger("chosen:updated"),a(".order_download_permissions").unblock()}),!1}}).on("click","button.revoke_access",function(b){b.preventDefault();var c=confirm(woocommerce_admin_meta_boxes.i18n_permission_revoke);if(c){var d=a(this).parent().parent(),e=a(this).attr("rel").split(",")[0],f=a(this).attr("rel").split(",")[1];if(e>0){a(d).block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var g={action:"woocommerce_revoke_access_to_download",product_id:e,download_id:f,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.revoke_access_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,g,function(){a(d).fadeOut("300",function(){a(d).remove()})})}else a(d).fadeOut("300",function(){a(d).remove()})}return!1}),a("button.load_customer_billing").click(function(){var b=confirm(woocommerce_admin_meta_boxes.load_billing);if(b){var c=a("#customer_user").val();if(!c)return alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var d={user_id:c,type_to_load:"billing",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};a(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}}),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:d,type:"POST",success:function(b){var c=b;c&&(a("input#_billing_first_name").val(c.billing_first_name),a("input#_billing_last_name").val(c.billing_last_name),a("input#_billing_company").val(c.billing_company),a("input#_billing_address_1").val(c.billing_address_1),a("input#_billing_address_2").val(c.billing_address_2),a("input#_billing_city").val(c.billing_city),a("input#_billing_postcode").val(c.billing_postcode),a("#_billing_country").val(c.billing_country),a("input#_billing_state").val(c.billing_state),a("input#_billing_email").val(c.billing_email),a("input#_billing_phone").val(c.billing_phone)),a(".edit_address").unblock()}})}return!1}),a("button.load_customer_shipping").click(function(){var b=confirm(woocommerce_admin_meta_boxes.load_shipping);if(b){var c=a("#customer_user").val();if(!c)return alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var d={user_id:c,type_to_load:"shipping",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};a(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}}),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:d,type:"POST",success:function(b){var c=b;c&&(a("input#_shipping_first_name").val(c.shipping_first_name),a("input#_shipping_last_name").val(c.shipping_last_name),a("input#_shipping_company").val(c.shipping_company),a("input#_shipping_address_1").val(c.shipping_address_1),a("input#_shipping_address_2").val(c.shipping_address_2),a("input#_shipping_city").val(c.shipping_city),a("input#_shipping_postcode").val(c.shipping_postcode),a("#_shipping_country").val(c.shipping_country),a("input#_shipping_state").val(c.shipping_state)),a(".edit_address").unblock()}})}return!1}),a("button.billing-same-as-shipping").click(function(){var b=confirm(woocommerce_admin_meta_boxes.copy_billing);return b&&(a("input#_shipping_first_name").val(a("input#_billing_first_name").val()),a("input#_shipping_last_name").val(a("input#_billing_last_name").val()),a("input#_shipping_company").val(a("input#_billing_company").val()),a("input#_shipping_address_1").val(a("input#_billing_address_1").val()),a("input#_shipping_address_2").val(a("input#_billing_address_2").val()),a("input#_shipping_city").val(a("input#_billing_city").val()),a("input#_shipping_postcode").val(a("input#_billing_postcode").val()),a("#_shipping_country").val(a("#_billing_country").val()),a("input#_shipping_state").val(a("input#_billing_state").val())),!1}),a(".totals_group").on("click","a.add_total_row",function(){return a(this).closest(".totals_group").find(".total_rows").append(a(this).data("row")),!1}),a(".total_rows").on("click","a.delete_total_row",function(){$row=a(this).closest(".total_row");var b=$row.attr("data-order_item_id");return b?$row.append('').hide():$row.remove(),!1}),a("#woocommerce-order-notes").on("click","a.add_note",function(){if(a("textarea#add_order_note").val()){a("#woocommerce-order-notes").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var b={action:"woocommerce_add_order_note",post_id:woocommerce_admin_meta_boxes.post_id,note:a("textarea#add_order_note").val(),note_type:a("select#order_note_type").val(),security:woocommerce_admin_meta_boxes.add_order_note_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,b,function(b){a("ul.order_notes").prepend(b),a("#woocommerce-order-notes").unblock(),a("#add_order_note").val("")}),!1}}).on("click","a.delete_note",function(){var b=a(this).closest("li.note");a(b).block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var c={action:"woocommerce_delete_order_note",note_id:a(b).attr("rel"),security:woocommerce_admin_meta_boxes.delete_order_note_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,c,function(){a(b).remove()}),!1})}); \ No newline at end of file +jQuery(function(a){function b(){a("#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}})}function c(){a("#woocommerce-order-items").unblock()}function d(){a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200})}function e(){var e={order_id:woocommerce_admin_meta_boxes.post_id,action:"woocommerce_load_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(b){a("#woocommerce-order-items .inside").empty(),a("#woocommerce-order-items .inside").append(b),d(),c()}})}a("#woocommerce-order-actions input, #woocommerce-order-actions a").click(function(){window.onbeforeunload=""}),a("a.edit_address").click(function(b){b.preventDefault(),a(this).hide(),a(this).closest(".order_data_column").find("div.address").hide(),a(this).closest(".order_data_column").find("div.edit_address").show()}),a("#order_items_list tr.item, #order_items_list tr.fee").each(function(){a(this).trigger("init_row"),a(this).find(".edit").hide()}),a("body").on("init_row","#order_items_list tr.item",function(){var b=a(this),c=b.find("input.quantity"),d=c.val(),e=accounting.unformat(b.find("input.line_subtotal").val(),woocommerce_admin.mon_decimal_point),f=accounting.unformat(b.find("input.line_total").val(),woocommerce_admin.mon_decimal_point),g=accounting.unformat(b.find("input.line_tax").val(),woocommerce_admin.mon_decimal_point),h=accounting.unformat(b.find("input.line_subtotal_tax").val(),woocommerce_admin.mon_decimal_point);d?(unit_subtotal=parseFloat(accounting.toFixed(e/d,woocommerce_admin_meta_boxes.rounding_precision)),unit_subtotal_tax=parseFloat(accounting.toFixed(h/d,woocommerce_admin_meta_boxes.rounding_precision)),unit_total=parseFloat(accounting.toFixed(f/d,woocommerce_admin_meta_boxes.rounding_precision)),unit_total_tax=parseFloat(accounting.toFixed(g/d,woocommerce_admin_meta_boxes.rounding_precision))):unit_subtotal=unit_subtotal_tax=unit_total=unit_total_tax=0,c.attr("data-o_qty",d),b.attr("data-unit_subtotal",unit_subtotal),b.attr("data-unit_subtotal_tax",unit_subtotal_tax),b.attr("data-unit_total",unit_total),b.attr("data-unit_total_tax",unit_total_tax)}).on("init_row","#order_items_list tr.fee",function(){var b=a(this),c=accounting.unformat(b.find("input.line_total").val(),woocommerce_admin.mon_decimal_point),d=accounting.unformat(b.find("input.line_tax").val(),woocommerce_admin.mon_decimal_point);unit_total=parseFloat(accounting.toFixed(c,woocommerce_admin_meta_boxes.rounding_precision)),unit_total_tax=parseFloat(accounting.toFixed(d,woocommerce_admin_meta_boxes.rounding_precision)),b.attr("data-unit_total",unit_total),b.attr("data-unit_total_tax",unit_total_tax)}).on("click","a.edit-order-item",function(){return a(this).closest("tr").find(".view").hide(),a(this).closest("tr").find(".edit").show(),a(this).hide(),a("button.add-line-item").click(),a("button.cancel-action").attr("data-reload",!0),!1}).on("click","#order_items_list a.delete-order-item",function(){var d=window.confirm(woocommerce_admin_meta_boxes.remove_item_notice);if(d){var e=a(this).closest("tr.item, tr.fee, tr.shipping"),f=e.attr("data-order_item_id");b();var g={order_item_ids:f,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:g,type:"POST",success:function(){e.remove(),c()}})}return!1}).on("click","#order_items_list .delete_refund",function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_refund)){var c=a(this).closest("tr.refund"),d=c.attr("data-order_refund_id");b();var f={action:"woocommerce_delete_refund",refund_id:d,security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:f,type:"POST",success:function(){e()}})}return!1}).on("change","#order_items_list input.quantity",function(){var b=a(this).closest("tr.item"),c=a(this).val(),d=b.attr("data-unit_subtotal"),e=b.attr("data-unit_subtotal_tax"),f=b.attr("data-unit_total"),g=b.attr("data-unit_total_tax"),h=(a(this).attr("data-o_qty"),parseFloat(accounting.formatNumber(d*c,woocommerce_admin_meta_boxes.rounding_precision,""))),i=parseFloat(accounting.formatNumber(e*c,woocommerce_admin_meta_boxes.rounding_precision,"")),j=parseFloat(accounting.formatNumber(f*c,woocommerce_admin_meta_boxes.rounding_precision,"")),k=parseFloat(accounting.formatNumber(g*c,woocommerce_admin_meta_boxes.rounding_precision,""));h=h.toString().replace(".",woocommerce_admin.mon_decimal_point),i=i.toString().replace(".",woocommerce_admin.mon_decimal_point),j=j.toString().replace(".",woocommerce_admin.mon_decimal_point),k=k.toString().replace(".",woocommerce_admin.mon_decimal_point),b.find("input.line_subtotal").val(h),b.find("input.line_total").val(j),b.find("input.line_subtotal_tax").val(i),b.find("input.line_tax").val(k),a(this).trigger("quantity_changed")}).on("change","#order_items_list input.line_subtotal",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_subtotal",e)}).on("change","#order_items_list input.line_total",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_total",e)}).on("change","#order_items_list input.line_subtotal_tax",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_subtotal_tax",e)}).on("change","#order_items_list input.line_tax",function(){var b=a(this).closest("tr.item"),c=b.find("input.quantity"),d=c.val(),e=d?accounting.toFixed(a(this).val()/d,woocommerce_admin_meta_boxes.rounding_precision):0;b.attr("data-unit_total_tax",e)}).on("change","#order_items_list .wc-order-item-refund-quantity input",function(){var b=0,c=a("#order_items_list").find("tr.item, tr.fee");c.each(function(){var c=a(this),d=c.find(".wc-order-item-refund-quantity input").val();d&&(b=parseFloat(b)+d*(parseFloat(c.attr("data-unit_total"))+parseFloat(c.attr("data-unit_total_tax"))))}),a("#refund_amount").val(b).change()}).on("click","#order_items_list button.add_order_item_meta",function(){var d=a(this),e=d.closest("tr.item"),f={order_item_id:e.attr("data-order_item_id"),action:"woocommerce_add_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};return b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:f,type:"POST",success:function(a){e.find("tbody.meta_items").append(a),c()}}),!1}).on("click","#order_items_list button.remove_order_item_meta",function(){var d=confirm(woocommerce_admin_meta_boxes.remove_item_meta);if(d){var e=a(this).closest("tr"),f={meta_id:e.attr("data-meta_id"),action:"woocommerce_remove_order_item_meta",security:woocommerce_admin_meta_boxes.order_item_nonce};b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:f,type:"POST",success:function(){e.hide(),c()}})}return!1}),a("#woocommerce-order-items").on("click","button.add-line-item",function(){return a("div.wc-order-add-item").slideDown(),a("div.wc-order-bulk-actions").slideUp(),!1}).on("click","button.refund-items",function(){return a("div.wc-order-refund-items").slideDown(),a("div.wc-order-bulk-actions").slideUp(),a("div.wc-order-totals-items").slideUp(),a(".wc-order-item-refund-quantity").show(),a(".wc-order-edit-line-item").hide(),!1}).on("click",".cancel-action",function(){return a(this).closest("div.wc-order-data-row").slideUp(),a("div.wc-order-bulk-actions").slideDown(),a("div.wc-order-totals-items").slideDown(),a(".wc-order-item-refund-quantity").hide(),a(".wc-order-edit-line-item").show(),"true"===a(this).attr("data-reload")&&e(),!1}).on("click","button.add-order-item",function(){return void 0===window.WCBackbone.Modal.__instance&&(window.WCBackbone.Modal.__instance=new WCBackbone.Modal.View({target:"#wc-modal-add-products"})),!1}).on("click","button.add-order-fee",function(){b();var d={action:"woocommerce_add_order_fee",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,d,function(b){a("table.woocommerce_order_items tbody#order_items_list").append(b),c()}),!1}).on("click","button.add-order-shipping",function(){b();var d={action:"woocommerce_add_order_shipping",order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,d,function(b){a("table.woocommerce_order_items tbody#order_items_list").append(b),c()}),!1}).on("click","input.check-column",function(){a(this).is(":checked")?a("#woocommerce-order-items").find(".check-column input").attr("checked","checked"):a("#woocommerce-order-items").find(".check-column input").removeAttr("checked")}).on("click",".do_bulk_action",function(){var d=a(this).closest(".bulk-actions").find("select").val(),e=a("#woocommerce-order-items").find(".check-column input:checked"),f=[];if(a(e).each(function(){var b=a(this).closest("tr.item, tr.fee");f.push(b.attr("data-order_item_id"))}),0==f.length)return void alert(woocommerce_admin_meta_boxes.i18n_select_items);if("delete"==d){var g=confirm(woocommerce_admin_meta_boxes.remove_item_notice);if(g){b();var h={order_item_ids:f,action:"woocommerce_remove_order_item",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:h,type:"POST",success:function(){a(e).each(function(){a(this).closest("tr.item, tr.fee").remove()}),c()}})}}else if("reduce_stock"==d){b();var i={};a(e).each(function(){var b=a(this).closest("tr.item, tr.fee"),c=b.find("input.quantity");i[b.attr("data-order_item_id")]=c.val()});var h={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:f,order_item_qty:i,action:"woocommerce_reduce_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:h,type:"POST",success:function(a){alert(a),c()}})}else if("increase_stock"==d){b();var i={};a(e).each(function(){var b=a(this).closest("tr.item, tr.fee"),c=b.find("input.quantity");i[b.attr("data-order_item_id")]=c.val()});var h={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:f,order_item_qty:i,action:"woocommerce_increase_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:h,type:"POST",success:function(a){alert(a),c()}})}return!1}).on("click","button.calculate-action",function(){if(window.confirm(woocommerce_admin_meta_boxes.calc_totals)){b();var c=0,d=0,e=0,f=a("#_order_discount").val()||"0";f=accounting.unformat(f.replace(",",".")),a("#order_items_list tr.item, #order_items_list tr.shipping .wc_input_price").each(function(){cost=a(this).val()||"0",cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point),e+=parseFloat(cost)}),a("#tax_rows").find("input[type=number], .wc_input_price").each(function(){cost=a(this).val()||"0",cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point),d+=parseFloat(cost)}),a("#order_items_list tr.item, #order_items_list tr.fee").each(function(){line_total=a(this).find("input.line_total").val()||"0",c+=accounting.unformat(line_total.replace(",","."))}),"yes"===woocommerce_admin_meta_boxes.round_at_subtotal&&(d=parseFloat(accounting.toFixed(d,woocommerce_admin_meta_boxes.rounding_precision))),a("#_order_total").val(accounting.formatNumber(c+d+e-f,woocommerce_admin_meta_boxes.currency_format_num_decimals,"",woocommerce_admin.mon_decimal_point)).change(),a("button.save-action").click()}return!1}).on("click","button.save-action",function(){var e={order_id:woocommerce_admin_meta_boxes.post_id,items:a("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize(),action:"woocommerce_save_order_items",security:woocommerce_admin_meta_boxes.order_item_nonce};return b(),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:e,type:"POST",success:function(b){a("#woocommerce-order-items .inside").empty(),a("#woocommerce-order-items .inside").append(b),d(),c()}}),!1}),a("body").on("change",".wc-order-refund-items #refund_amount",function(){a("button .wc-order-refund-amount .amount").text(accounting.formatMoney(a(this).val(),{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}))}).on("click",".wc-order-refund-items button.do-api-refund, .wc-order-refund-items button.do-manual-refund",function(){if(b(),window.confirm(woocommerce_admin_meta_boxes.i18n_do_refund)){var d=a("input#refund_amount").val(),f=a("input#refund_reason").val(),g=a.map(a("input[type=number][name^=order_item_refund_qty]"),function(b){var c=[];return c.push(a(b).closest("tr.item,tr.fee").data("order_item_id"),b.value),c}),h={action:"woocommerce_refund_line_items",order_id:woocommerce_admin_meta_boxes.post_id,refund_amount:d,refund_reason:f,refund_qty:JSON.stringify(g,null,""),api_refund:a(this).is(".do-api-refund"),security:woocommerce_admin_meta_boxes.order_item_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,h,function(a){a===!0?e():a.error&&(window.alert(a.error),c())})}else c()}),a("#woocommerce-order-totals").on("change input",".order_taxes_amount, .order_taxes_shipping_amount, .shipping_cost, #_order_discount",function(){var b=a(this),c=b.closest(".totals_group").find("input[type=number], .wc_input_price"),d=0;c.each(function(){a(this).val()&&(d+=accounting.unformat(a(this).val(),woocommerce_admin.mon_decimal_point))}),(b.is(".order_taxes_amount")||b.is(".order_taxes_shipping_amount"))&&(d=round(d,woocommerce_admin_meta_boxes.currency_format_num_decimals,woocommerce_admin_meta_boxes.tax_rounding_mode));var e=accounting.formatMoney(d,{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});b.closest(".totals_group").find("span.inline_total").text(e)}).on("click","button.calc_line_taxes",function(){a(".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 b=confirm(woocommerce_admin_meta_boxes.calc_line_taxes);if(b){var c=a("#order_items_list").find("tr.item, tr.fee"),d=a("#_shipping_country").val(),e=a("#_billing_country").val();if(d)var f=d,g=a("#_shipping_state").val(),h=a("#_shipping_postcode").val(),i=a("#_shipping_city").val();else if(e)var f=e,g=a("#_billing_state").val(),h=a("#_billing_postcode").val(),i=a("#_billing_city").val();else var f=woocommerce_admin_meta_boxes.base_country,g="",h="",i="";var j={};c.each(function(){var b=a(this),c=b.find("input.order_item_id").val(),d=b.find("input.line_subtotal").val(),e=b.find("input.line_total").val(),f=b.find("select.tax_class").val();j[c]={},j[c].line_subtotal=d,j[c].line_total=e,j[c].tax_class=f}),order_shipping=0,a("#shipping_rows").find("input[type=number], .wc_input_price").each(function(){cost=a(this).val()||"0",cost=accounting.unformat(cost,woocommerce_admin.mon_decimal_point),order_shipping+=parseFloat(cost)});var k={action:"woocommerce_calc_line_taxes",order_id:woocommerce_admin_meta_boxes.post_id,items:j,shipping:order_shipping,country:f,state:g,postcode:h,city:i,security:woocommerce_admin_meta_boxes.calc_totals_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,k,function(b){b&&(c.each(function(){var c=a(this),d=c.find("input.order_item_id").val();c.find(".edit-order-item").click(),b.item_taxes[d]&&(c.find("input.line_tax").val(b.item_taxes[d].line_tax).change(),c.find("input.line_subtotal_tax").val(b.item_taxes[d].line_subtotal_tax).change()),b.tax_row_html&&a("#tax_rows").empty().append(b.tax_row_html)}),a("#tax_rows").find("input").change()),a(".woocommerce_order_items_wrapper").unblock()})}else a(".woocommerce_order_items_wrapper").unblock();return!1}),a("body").on("wc_backbone_modal_response",function(e,f){if("#wc-modal-add-products"===f){var g=a("select#add_item_id").val();g?(count=g.length,b(),a.each(g,function(b,e){var f={action:"woocommerce_add_order_item",item_to_add:e,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,f,function(b){a("table.woocommerce_order_items tbody#order_items_list").append(b),--count||(a("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","").val(""),d(),a("select#add_item_id").trigger("chosen:updated"),c()),a("#order_items_list tr.new_row").trigger("init_row").removeClass("new_row")})})):a("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","red")}}),a("span.inline_total").closest(".totals_group").find("input").change(),a(".order_download_permissions").on("click","button.grant_access",function(){var b=a("select#grant_access_id").val();if(b){a(".order_download_permissions").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var c={action:"woocommerce_grant_access_to_download",product_ids:b,loop:a(".order_download_permissions .wc-metabox").size(),order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.grant_access_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,c,function(b){b?a(".order_download_permissions .wc-metaboxes").append(b):alert(woocommerce_admin_meta_boxes.i18n_download_permission_fail),a(".date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0,showOn:"button",buttonImage:woocommerce_admin_meta_boxes.calendar_image,buttonImageOnly:!0}),a("#grant_access_id").val("").trigger("chosen:updated"),a(".order_download_permissions").unblock()}),!1}}).on("click","button.revoke_access",function(b){b.preventDefault();var c=confirm(woocommerce_admin_meta_boxes.i18n_permission_revoke);if(c){var d=a(this).parent().parent(),e=a(this).attr("rel").split(",")[0],f=a(this).attr("rel").split(",")[1];if(e>0){a(d).block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var g={action:"woocommerce_revoke_access_to_download",product_id:e,download_id:f,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.revoke_access_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,g,function(){a(d).fadeOut("300",function(){a(d).remove()})})}else a(d).fadeOut("300",function(){a(d).remove()})}return!1}),a("button.load_customer_billing").click(function(){var b=confirm(woocommerce_admin_meta_boxes.load_billing);if(b){var c=a("#customer_user").val();if(!c)return alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var d={user_id:c,type_to_load:"billing",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};a(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}}),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:d,type:"POST",success:function(b){var c=b;c&&(a("input#_billing_first_name").val(c.billing_first_name),a("input#_billing_last_name").val(c.billing_last_name),a("input#_billing_company").val(c.billing_company),a("input#_billing_address_1").val(c.billing_address_1),a("input#_billing_address_2").val(c.billing_address_2),a("input#_billing_city").val(c.billing_city),a("input#_billing_postcode").val(c.billing_postcode),a("#_billing_country").val(c.billing_country),a("input#_billing_state").val(c.billing_state),a("input#_billing_email").val(c.billing_email),a("input#_billing_phone").val(c.billing_phone)),a(".edit_address").unblock()}})}return!1}),a("button.load_customer_shipping").click(function(){var b=confirm(woocommerce_admin_meta_boxes.load_shipping);if(b){var c=a("#customer_user").val();if(!c)return alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var d={user_id:c,type_to_load:"shipping",action:"woocommerce_get_customer_details",security:woocommerce_admin_meta_boxes.get_customer_details_nonce};a(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}}),a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:d,type:"POST",success:function(b){var c=b;c&&(a("input#_shipping_first_name").val(c.shipping_first_name),a("input#_shipping_last_name").val(c.shipping_last_name),a("input#_shipping_company").val(c.shipping_company),a("input#_shipping_address_1").val(c.shipping_address_1),a("input#_shipping_address_2").val(c.shipping_address_2),a("input#_shipping_city").val(c.shipping_city),a("input#_shipping_postcode").val(c.shipping_postcode),a("#_shipping_country").val(c.shipping_country),a("input#_shipping_state").val(c.shipping_state)),a(".edit_address").unblock()}})}return!1}),a("button.billing-same-as-shipping").click(function(){var b=confirm(woocommerce_admin_meta_boxes.copy_billing);return b&&(a("input#_shipping_first_name").val(a("input#_billing_first_name").val()),a("input#_shipping_last_name").val(a("input#_billing_last_name").val()),a("input#_shipping_company").val(a("input#_billing_company").val()),a("input#_shipping_address_1").val(a("input#_billing_address_1").val()),a("input#_shipping_address_2").val(a("input#_billing_address_2").val()),a("input#_shipping_city").val(a("input#_billing_city").val()),a("input#_shipping_postcode").val(a("input#_billing_postcode").val()),a("#_shipping_country").val(a("#_billing_country").val()),a("input#_shipping_state").val(a("input#_billing_state").val())),!1}),a(".totals_group").on("click","a.add_total_row",function(){return a(this).closest(".totals_group").find(".total_rows").append(a(this).data("row")),!1}),a(".total_rows").on("click","a.delete_total_row",function(){$row=a(this).closest(".total_row");var b=$row.attr("data-order_item_id");return b?$row.append('').hide():$row.remove(),!1}),a("#woocommerce-order-notes").on("click","a.add_note",function(){if(a("textarea#add_order_note").val()){a("#woocommerce-order-notes").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var b={action:"woocommerce_add_order_note",post_id:woocommerce_admin_meta_boxes.post_id,note:a("textarea#add_order_note").val(),note_type:a("select#order_note_type").val(),security:woocommerce_admin_meta_boxes.add_order_note_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,b,function(b){a("ul.order_notes").prepend(b),a("#woocommerce-order-notes").unblock(),a("#add_order_note").val("")}),!1}}).on("click","a.delete_note",function(){var b=a(this).closest("li.note");a(b).block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var c={action:"woocommerce_delete_order_note",note_id:a(b).attr("rel"),security:woocommerce_admin_meta_boxes.delete_order_note_nonce};return a.post(woocommerce_admin_meta_boxes.ajax_url,c,function(){a(b).remove()}),!1})}); \ No newline at end of file diff --git a/includes/admin/meta-boxes/views/html-order-items.php b/includes/admin/meta-boxes/views/html-order-items.php index 593b70b0d20..e76a57325df 100644 --- a/includes/admin/meta-boxes/views/html-order-items.php +++ b/includes/admin/meta-boxes/views/html-order-items.php @@ -71,19 +71,19 @@ if ( ! defined( 'ABSPATH' ) ) {
: | +[?]: | get_total_shipping() ); ?> | |
: | +[?]: | get_total_tax() ); ?> | |
: | +[?]: |
get_total_discount() ); ?>
- |