"+l+"<\/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.")}}))}}$(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()});$("#uploadItemLink").click(function(n){n.preventDefault();$("#import-excel").show();$(".upload-overlay").addClass("active");$("div.upload-error").html("").removeClass("upload-excel-error")});$("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="",i=guid(),t;n+='
<\/td>
<\/td>
<\/td>
<\/td>
<\/td><\/tr>';t=$("table.qo-table tbody tr").length;t>0?t<5&&$("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 items?"))return $("#txtPaste").val("").focus(),$("div.lopMsgError").html("").removeClass("lopError"),!0}else $("#txtPaste").val("").focus(),$("div.lopMsgError").html("").removeClass("lopError")});$("#quickOrderItemEntry-addrows2").click(function(){var n=$("table.qo-table tbody tr").length;n!=5&&(document.getElementById("quickOrderItemEntry-addrows2").disabled=!1);document.getElementById("quickOrderItemEntry-addrows2").disabled=n==5?!0:!1;n++});$("#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 items?"))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=""})});$("#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 n,t;if(AjaxCart.loadWaiting==!1){var i=$(this).parent().next().next(),u=$(this).parent().next(),r=$(this).parent().next().next().next();if($(this).val().length<=0)i.html(""),$(this).parent().next().find("input").val(""),r.html("");else{if(AjaxCart.setLoadWaiting(!0),n=0,t=1,$("input[idPostFix='"+n+"']").length>0)for(n=t;$("input[idPostFix='"+n+"']").length>0;)t++,n=t;$.ajax({cache:!1,url:"/quickorder/searchsku?idPostFix="+n+"&sku="+$(this).val(),type:"get",success:function(n){var f,e,t;if(n.errormsg)t='
<\/ul><\/div>';i.html(t)}},complete:AjaxCart.resetLoadWaiting(),error:function(){}})}}});$(document).on("click","input.delete-largeordepadrow-button",function(){var t=$(this).closest("tr"),r=$(this).closest("tr").find("td.desc").find("div").find("ul").text(),e=$(this).closest("tr").find("td.price").find("div").text(),n=$("table.qo-table tbody tr"),i,u,f;if(r!=""&&e!=""){for(i=0;i0;i++)if(u=$(n[i]).find("td.desc").find("div").find("ul").text(),r==u&&(f="Are you sure you want to remove this product?",confirm(f))){if(n.length==1)return t.remove(),$("#quickOrderItemEntry-addrows2").trigger("click"),document.getElementById("quickOrderItemEntry-addrows2").disabled=!1,!0;if(n.length<=5)return document.getElementById("quickOrderItemEntry-addrows2").disabled=!1,t.remove(),!0}}else n.length<=1?(document.getElementById("quickOrderItemEntry-addrows2").disabled=!1,t.remove(),$("#quickOrderItemEntry-addrows2").trigger("click")):t.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.").addClass("lopError"),AjaxCart.setLoadWaiting(!1),!1):void 0})