2014-07-22 15:44:23 +00:00
|
|
|
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_line_items tr, #order_fee_line_items tr").each(function(){a(this).trigger("init_row"),a(this).find(".edit").hide()}),a("body").on("init_row","#order_line_items 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_fee_line_items 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",".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",fu
|