1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
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("body").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",".woocommerce_order_items 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_refunds .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",".woocommerce_order_items input.quantity",function(){var b=a(this).closest("tr.item"),c=a(this).val(),d=(a(this).attr("data-qty"),a("input.line_total",b)),e=a("input.line_subtotal",b),f=accounting.unformat(d.attr("data-total"),woocommerce_admin.mon_decimal_point);d.val(parseFloat(accounting.formatNumber(f*c,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point));var g=accounting.unformat(e.attr("data-subtotal"),woocommerce_admin.mon_decimal_point);e.val(parseFloat(accounting.formatNumber(g*c,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)),a("td.line_tax",b).each(function(){var b=a("input.line_tax",a(this)),d=accounting.unformat(b.attr("data-total_tax"),woocommerce_admin.mon_decimal_point);d>0&&b.val(parseFloat(accounting.formatNumber(d*c,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point));var e=a("input.line_subtotal_tax",a(this)),f=accounting.unformat(e.attr("data-subtotal_tax"),woocommerce_admin.mon_decimal_point);f>0&&e.val(parseFloat(accounting.formatNumber(f*c,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point))}),a(this).trigger("quantity_changed")}).on("change",".woocommerce_order_items input.refund_order_item_qty",function(){var b=a(this).closest("tr.item"),c=a(this).val(),d=(b.find("input.quantity").attr("data-qty"),a("input.line_total",b)),e=a("input.refund_line_total",b),f=accounting.unformat(d.attr("data-total"),woocommerce_admin.mon_decimal_point);e.val(parseFloat(accounting.formatNumber(f*c,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point)),a("td.line_tax",b).each(function(){var b=a("input.line_tax",a(this)),d=a("input.refund_line_tax",a(this)),e=accounting.unformat(b.attr("data-total_tax"),woocommerce_admin.mon_decimal_point);e>0&&d.val(parseFloat(accounting.formatNumber(e*c,woocommerce_admin_meta_boxes.rounding_precision,"")).toString().replace(".",woocommerce_admin.mon_decimal_point))}),a(this).trigger("refund_quantity_changed")}).on("change",".woocommerce_order_items .refund input",function(){var b=0,c=a(".woocommerce_order_items").find("tr.item, tr.fee, tr.shipping");c.each(function(){var c=a(this),d=c.find(".refund input:not(.refund_order_item_qty)");d.each(function(c,d){b+=parseFloat(accounting.unformat(a(d).val()||0,woocommerce_admin.mon_decimal_point))})}),a("#refund_amount").val(accounting.formatNumber(b,woocommerce_admin_meta_boxes.currency_format_num_decimals,"",woocommerce_admin.mon_decimal_point)).change()}).on("click",".woocommerce_order_items 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",".woocommerce_order_items button.remove_order_item_meta",function(){if(window.confirm(woocommerce_admin_meta_boxes.remove_item_meta)){var d=a(this).closest("tr"),e={meta_id:d.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:e,type:"POST",success:function(){d.hide(),c()}})}return!1}).on("keyup",".woocommerce_order_items .split-input input:eq(0)",function(){var b=a(this).next();(""===b.val()||b.is(".match-total"))&&b.val(a(this).val()).addClass("match-total")}).on("keyup",".woocommerce_order_items .split-input input:eq(0)",function(){a(this).removeClass("match-total")}),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("#woocommerce-order-items div.refund").show(),a(".wc-order-edit-line-item .wc-order-edit-line-item-actions").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("#woocommerce-order-items div.refund").hide(),a(".wc-order-edit-line-item .wc-order-edit-line-item-actions").show(),"true"===a(this).attr("data-reload")&&e(),!1}).on("click","button.add-order-item",function(){return a(this).WCBackboneModal({template:"#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_fee_line_items").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_shipping_line_items").append(b),c()}),!1}).on("click","button.add-order-tax",function(){return a(this).WCBackboneModal({template:"#wc-modal-add-tax"}),!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");b.attr("data-order_item_id")&&f.push(b.attr("data-order_item_id"))}),0===f.length)return void window.alert(woocommerce_admin_meta_boxes.i18n_select_items);if("delete"===d){if(window.confirm(woocommerce_admin_meta_boxes.remove_item_notice)){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(){a(e).each(function(){a(this).closest("tr").remove()}),c()}})}}else if("reduce_stock"===d){b();var h={};a(e).each(function(){var b=a(this).closest("tr.item, tr.fee"),c=b.find("input.quantity");h[b.attr("data-order_item_id")]=c.val()});var g={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:f,order_item_qty:h,action:"woocommerce_reduce_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:g,type:"POST",success:function(a){window.alert(a),c()}})}else if("increase_stock"===d){b();var h={};a(e).each(function(){var b=a(this).closest("tr.item, tr.fee"),c=b.find("input.quantity");h[b.attr("data-order_item_id")]=c.val()});var g={order_id:woocommerce_admin_meta_boxes.post_id,order_item_ids:f,order_item_qty:h,action:"woocommerce_increase_order_item_stock",security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:g,type:"POST",success:function(a){window.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(".woocommerce_order_items tr.shipping input.line_total").each(function(){var b=a(this).val()||"0";b=accounting.unformat(b,woocommerce_admin.mon_decimal_point),e+=parseFloat(b)}),a(".woocommerce_order_items input.line_tax").each(function(){var b=a(this).val()||"0";b=accounting.unformat(b,woocommerce_admin.mon_decimal_point),d+=parseFloat(b)}),a(".woocommerce_order_items tr.item, .woocommerce_order_items tr.fee").each(function(){var b=a(this).find("input.line_total").val()||"0";c+=accounting.unformat(b.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}).on("click","a.delete-order-tax",function(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_delete_tax)){b();var e={action:"woocommerce_remote_order_tax",rate_id:a(this).attr("data-rate_id"),order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};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()}})}return!1}).on("click","button.calculate-tax-action",function(){if(window.confirm(woocommerce_admin_meta_boxes.calc_line_taxes)){b();var e=a("#_shipping_country").val(),f=a("#_billing_country").val(),g=woocommerce_admin_meta_boxes.base_country,h="",i="",j="";e?(g=e,h=a("#_shipping_state").val(),i=a("#_shipping_postcode").val(),j=a("#_shipping_city").val()):f&&(g=f,h=a("#_billing_state").val(),i=a("#_billing_postcode").val(),j=a("#_billing_city").val());var k={action:"woocommerce_calc_line_taxes",order_id:woocommerce_admin_meta_boxes.post_id,items:a("table.woocommerce_order_items :input[name], .wc-order-totals-items :input[name]").serialize(),country:g,state:h,postcode:i,city:j,security:woocommerce_admin_meta_boxes.calc_totals_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:k,type:"POST",success:function(b){a("#woocommerce-order-items .inside").empty(),a("#woocommerce-order-items .inside").append(b),d(),c()}})}return!1}),a("body").on("change",".wc-order-refund-items #refund_amount",function(){var b=accounting.unformat(a(this).val(),woocommerce_admin.mon_decimal_point);a("button .wc-order-refund-amount .amount").text(accounting.formatMoney(b,{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={},h={},i={};a(".refund input.refund_order_item_qty").each(function(b,c){a(c).closest("tr").data("order_item_id")&&c.value&&(g[a(c).closest("tr").data("order_item_id")]=c.value)}),a(".refund input.refund_line_total").each(function(b,c){a(c).closest("tr").data("order_item_id")&&(h[a(c).closest("tr").data("order_item_id")]=accounting.unformat(c.value,woocommerce_admin.mon_decimal_point))}),a(".refund input.refund_line_tax").each(function(b,c){if(a(c).closest("tr").data("order_item_id")){var d=a(c).data("tax_id");i[a(c).closest("tr").data("order_item_id")]||(i[a(c).closest("tr").data("order_item_id")]={}),i[a(c).closest("tr").data("order_item_id")][d]=accounting.unformat(c.value,woocommerce_admin.mon_decimal_point)}});var j={action:"woocommerce_refund_line_items",order_id:woocommerce_admin_meta_boxes.post_id,refund_amount:d,refund_reason:f,line_item_qtys:JSON.stringify(g,null,""),line_item_totals:JSON.stringify(h,null,""),line_item_tax_totals:JSON.stringify(i,null,""),api_refund:a(this).is(".do-api-refund"),restock_refunded_items:a("#restock_refunded_items:checked").size()?"true":"false",security:woocommerce_admin_meta_boxes.order_item_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,j,function(a){a===!0?e():a.error?(window.alert(a.error),c()):console.log(a)})}else c()}),a("body").on("wc_backbone_modal_response",function(e,f){if("#wc-modal-add-products"===f){var g=a("select#add_item_id").val();if(g){var h=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_line_items").append(b),--h||(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())})})}else a("select#add_item_id, #add_item_id_chosen .chosen-choices").css("border-color","red")}}),a("body").on("wc_backbone_modal_response",function(e,f){if("#wc-modal-add-tax"===f){var g=a("#manual_tax_rate_id").val(),h=a("input[name=add_order_tax]:checked").val();if(g&&(h=g),!h)return!1;var i=a(".order-tax-id").map(function(){return a(this).val()}).get();if(-1===a.inArray(h,i)){b();var j={action:"woocommerce_add_order_tax",rate_id:h,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.order_item_nonce};a.ajax({url:woocommerce_admin_meta_boxes.ajax_url,data:j,type:"POST",success:function(b){a("#woocommerce-order-items .inside").empty(),a("#woocommerce-order-items .inside").append(b),d(),c()}})}else window.alert(woocommerce_admin_meta_boxes.i18n_tax_rate_already_exists)}}),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):window.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(){if(window.confirm(woocommerce_admin_meta_boxes.i18n_permission_revoke)){var b=a(this).parent().parent(),c=a(this).attr("rel").split(",")[0],d=a(this).attr("rel").split(",")[1];if(c>0){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 e={action:"woocommerce_revoke_access_to_download",product_id:c,download_id:d,order_id:woocommerce_admin_meta_boxes.post_id,security:woocommerce_admin_meta_boxes.revoke_access_nonce};a.post(woocommerce_admin_meta_boxes.ajax_url,e,function(){a(b).fadeOut("300",function(){a(b).remove()})})}else a(b).fadeOut("300",function(){a(b).remove()})}return!1}),a("button.load_customer_billing").on("click",function(){if(window.confirm(woocommerce_admin_meta_boxes.load_billing)){var b=a("#customer_user").val();if(!b)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var c={user_id:b,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:c,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").on("click",function(){if(window.confirm(woocommerce_admin_meta_boxes.load_shipping)){var b=a("#customer_user").val();if(!b)return window.alert(woocommerce_admin_meta_boxes.no_customer_selected),!1;var c={user_id:b,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:c,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").on("click",function(){return window.confirm(woocommerce_admin_meta_boxes.copy_billing)&&(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(){var b=a(this).closest(".total_row"),c=b.attr("data-order_item_id");return c?b.append('<input type="hidden" name="delete_order_item_id[]" value="'+c+'" />').hide():b.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})}); |