"+c+"<\/li>",r+="<\/ul><\/div>",$(u).find("td.desc").html(r);$("div.quickOrderItemEntry").show();$("div.quickOrderContainer").hide()}},complete:function(){AjaxCart.setLoadWaiting(!1)},error:function(){alert("Failed to add the product. Please refresh the page and try one more time.")}}))}function validateQty(n){var t=n.which?n.which:event.keyCode;if(String.fromCharCode(t).match(/[^0-9]/g))return!1}$(document).ready(function(){$("#quickOrderPasteEntry-back").click(function(n){n.preventDefault();$("div.quickOrderItemEntry").show();$("div.quickOrderContainer").hide();$("#txtPaste").val("");$("table.qo-table .qo-sku").eq(0).focus()});$("#pasteItemPageLink").click(function(n){n.preventDefault();$("div.quickOrderItemEntry").hide();$("div.quickOrderContainer").show();$("#txtPaste").val("");$("#txtPaste").focus();$("div.lopMsgError").html("").removeClass("lopError")});$("#uploadItemLink").click(function(n){n.preventDefault();$("#import-excel").show();$(".upload-overlay").addClass("active");$("div.upload-error").html("").removeClass("upload-excel-error");$("body").addClass("scroll-hidden")});$("table.qo-table tbody tr").each(function(){var n=guid();$(this).find("td.sku").find("input").attr("name","qosku"+n);$(this).find("td.qty").find("input").attr("name","qoqty"+n)});$("table.qo-table .qo-sku").eq(0).focus();$("#quickOrderItemEntry-addrows2").click(function(){var n="",t=guid(),i;n+='
<\/td>
<\/td>
<\/td><\/tr>';i=$("table.qo-table tbody tr").length;i>0?$("table.qo-table tbody tr:last").after(n):$("table.qo-table tbody").html(n);bindautocomplete()});$("#quickOrderPasteEntry-clearrows").click(function(){var n=$("#txtPaste").val();if(n.length>0){if(confirm("Are you sure you want to clear all this item(s)?"))return $("#txtPaste").val("").focus(),$("div.lopMsgError").html("").removeClass("lopError"),!0}else $("#txtPaste").val("").focus(),$("div.lopMsgError").html("").removeClass("lopError")});$("#quickOrderItemEntry-clearrows2").click(function(){for(var r,t=$("table.qo-table tbody tr"),i=0,n=0;n0;n++)r=$(t[n]).find("td.desc").find("div").find("ul").text(),r!=""&&i++;if(i>0){if(confirm("Are you sure you want to clear all this item(s)?"))return window.location.href="",!0}else window.location.href=""});bindautocomplete();$(window).resize(function(){$(".modal-box").css({top:($(window).height()-$(".modal-box").outerHeight())/2,left:($(window).width()-$(".modal-box").outerWidth())/2})});$("#quickOrderItemEntry-import2").click(function(){$("html").addClass("popup-enable");$("#import-excel").show()});$("#import-excel-close").click(function(){$("#import-excel").hide();$(".upload-overlay").removeClass("active");$("html").removeClass("popup-enable");$("div.upload-error").html("").removeClass("upload-excel-error");document.getElementById("upload-quick-order-file").value="";$("body").removeClass("scroll-hidden")})});$("#btn-addtocart").click(function(){AjaxCart.setLoadWaiting(!0);$("div.lopMsg").html("").removeClass("lopError");var n=!0;return $("table.qo-table tr input.qo-sku").each(function(){var t=$(this).val();$.trim(t).length>0&&(n=!1)}),n?($("div.lopMsg").html("Please add atleast one SKU to add to cart.").addClass("lopError"),AjaxCart.setLoadWaiting(!1),!1):void 0});$("#btn-wishlist").click(function(){var n=!0;return $("table.qo-table tr input.qo-sku").each(function(){var t=$(this).val();$.trim(t).length>0&&(n=!1)}),n?($("div.lopMsg").html("Please add atleast one SKU to add to wishlist.").addClass("lopError"),AjaxCart.setLoadWaiting(!1),!1):void 0});$(document).on("change","input.qo-sku",function(){var t,r;if(AjaxCart.loadWaiting==!1){var n=$(this).parent().next().next(),i=$(this).parent().next(),u=$(this).attr("name");$(this).val().length<=0?(n.html(""),$(this).parent().next().find("input").val("")):(AjaxCart.setLoadWaiting(!0),t=u,r={idPostFix:t,sku:$(this).val()},$.ajax({cache:!1,url:"/quickorder/searchsku",data:r,type:"get",success:function(r){var f,u;r.errormsg?($(".ui-autocomplete").prop("style","top: 523px; left: 387.5px; width: 208px; display: none;"),u='
<\/ul><\/div>',n.html(u),$("li.li-product-name-"+f).tooltip({content:''}))},complete:AjaxCart.resetLoadWaiting(),error:function(){}}))}});$(document).on("click","input.delete-largeordepadrow-button",function(){var n=$(this).closest("tr"),r=$(this).closest("tr").find("td.desc").find("div").find("ul").text(),t=$("table.qo-table tbody tr"),i;if(r!=""){if(i="Are you sure you want to remove this product?",confirm(i))return t.length==1?(n.remove(),$("#quickOrderItemEntry-addrows2").trigger("click"),document.getElementById("quickOrderItemEntry-addrows2").disabled=!1,!0):(n.remove(),!0);$(n).eq(0).focus()}else t.length<=1?(document.getElementById("quickOrderItemEntry-addrows2").disabled=!1,n.remove(),$("#quickOrderItemEntry-addrows2").trigger("click")):(t.length<=5&&(document.getElementById("quickOrderItemEntry-addrows2").disabled=!1),n.remove())});$("#btn-addtocart-PasteEntry").click(function(){var n=!0,t=$("#txtPaste").val();return t.length>0&&(n=!1),n?($("div.lopMsgError").html("Please add at least one SKU to add to quick order.").addClass("lopError"),AjaxCart.setLoadWaiting(!1),!1):void 0});$(document).keydown(function(n){n.keyCode===27&&($(".modal-box").hide(),$(".upload-overlay").removeClass("active"),$("html").removeClass("popup-enable"),$("div.upload-error").html("").removeClass("upload-excel-error"),document.getElementById("upload-quick-order-file").value="",$("body").removeClass("scroll-hidden"),$(".quickOrder-overlay").hide(),$("html").removeClass("popup-enable"))})