You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
50 KiB
66 lines
50 KiB
$(document).ready(function(){try{CreateOrderHistoryDataTable();CreateInvoiceDataTable();CreateOpenLinesDataTable();CreateOrderSearchDataTable();CreateSavedCartsDataTable();CreateProjectsDataTable();CreateQuotesDataTable();CreateBomDataTable();$(".DTTT_button_xls").removeClass("DTTT_button ui-button ui-state-default DTTT_button_xls").addClass("excel");$(".DTTT_button_print").removeClass("DTTT_button ui-button ui-state-default DTTT_button_print").addClass("print");$(".dataTables_paginate").find(".previous, .next").hide();
|
|
$('input[title!=""].hint').hint()}catch(a){$(".dataTables_processing").css("visibility","hidden")}});function AddLinks(){$("div.floatleft.padding10leftright").hide();var b="";var k="";var e="";var c="";var g=$("select[id$=ddlOhNavigation] option").length;if(g>3){b=$("select[id$=ddlOhNavigation] option:nth(0)").html();k=$("select[id$=ddlOhNavigation] option:nth(1)").html();e=$("select[id$=ddlOhNavigation] option:nth(2)").html();c=$("select[id$=ddlOhNavigation] option:nth(3)").html()}else{k=$("select[id$=ddlOhNavigation] option:nth(0)").html();
|
|
e=$("select[id$=ddlOhNavigation] option:nth(1)").html();c=$("select[id$=ddlOhNavigation] option:nth(2)").html()}var f=(g<=3?"":"<a href='https://cn.mouser.lan/OrderHistory/OrdersView.aspx'><b>"+b+"</b></a> | ");var h="<a href='/OrderHistory/OpenLinesView.aspx'><b>"+k+"</b></a>";var i="<a href='/OrderHistory/OrdersView.aspx'><b>"+e+"</b></a>";var j="<a href='/OrderHistory/SearchView.aspx'><b>"+c+"</b></a>";var a='<div class="padding10left"><br><br><b>'+$("div.floatleft.padding10leftright").contents("b").html()+"</b> "+f+h+" | "+i+" | "+j+"</div>";
|
|
$("div#divOrderHistoryToolTip").after(a)}function CreateOrderHistoryDataTable(){if($("table#tblOrders").length==0){return}AddLinks();var a=$("table#tblOrders").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Orders?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[1,"desc"]],oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sFileName:dataTableResources.Mouser+dataTableResources.AllOrders.replace(" ","")+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".csv",sButtonText:dataTableResources.ExportPageToExcel,mColumns:"visible",fnCellRender:function(c,b){return ExtractData(c,b,", ")
|
|
}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"DateCreated",bVisible:false,bSearchable:false},{mData:"SalesOrderDateDisplay",iDataSort:0,bSearchable:false,sWidth:"10%"},{mData:"SalesOrderNumber",bVisible:false},{mData:"WebOrderNumber",bVisible:false},{mData:"SalesOrderNumberDisplay",iDataSort:1,bSearchable:false},{mData:"WebOrderNumberDisplay",iDataSort:2,bSearchable:false},{mData:"PoNumber",iDataSort:3,sWidth:"12%"},{mData:"BuyerName",iDataSort:4,bSearchable:false,sWidth:"12%"},{mData:"OpenLines",bVisible:false,bSearchable:false},{mData:"OpenTotal",bVisible:false,bSearchable:false},{mData:"CurrencyCode",bVisible:false,bSearchable:false},{mData:"OrderStatus",bVisible:false,bSearchable:false},{mData:"UpgradeShipSource",bVisible:false,bSearchable:false},{mData:"WaivedShipFlag",bVisible:false,bSearchable:false},{mData:"StatusToolTip",bVisible:false,bSearchable:false},{mData:"OrderStatusDisplay",iDataSort:8,bSearchable:false},{mData:"ShipmentNumber",bVisible:false,bSearchable:false},{mData:"ShipToCountry",bVisible:false,bSearchable:false},{mData:"PaymentGuid",bVisible:false,bSearchable:false},{mData:"PaymentMethodId",bVisible:false,bSearchable:false},{mData:"ActionItem",bVisible:false,bSearchable:false},{mData:"InvoiceNumberDisplay",bSortable:false,bSearchable:false},{mData:"InvoiceTotalDisplay",bSortable:false,bSearchable:false},{mData:"InvoiceDateDisplay",bSortable:false,bSearchable:false},{mData:"TrackingNumbersDisplay",bSortable:false,bSearchable:false}],fnHeaderCallback:function(f,g,e,c,b){$("#divStatusToolTip").remove();
|
|
if(g.length>0&&g[0].StatusToolTip&&g[0].StatusToolTip.length>0){$('<div id="divStatusToolTip" class="hidden">'+g[0].StatusToolTip+" </div>").appendTo("body")}},fnDrawCallback:function(e){if($("img.status-bar").length>0||$("img.red-dot").length>0){var c=$("img.status-bar:first").length+$("img.red-dot:first").length;var f="ShowStatusToolTip('"+c+"');";var b="HideStatusToolTip();";if($("img.status-help-icon").length==0){$('<img src="/Images/icon_tooltip.png" width="14" height="14" class="status-help-icon" onmouseover="'+f+'" onmouseout="'+b+'" />').appendTo(".dataTable th:nth(5) .DataTables_sort_wrapper")
|
|
}}else{$("img.status-help-icon").remove()}},oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error">'+dataTableResources.lblOrderHistoryNoRecord3+"</span>",sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},fnServerData:function(b,c,f,e){c.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()},{name:"buyerFilter",value:$("select[id$=ddlBuyer] option:selected").text()},{name:"buyerValue",value:$("select[id$=ddlBuyer] option:selected").val()},{name:"statusValue",value:$("select[id$=ddlOrderStatus] option:selected").val()});
|
|
e.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:b,data:c,success:f,error:function(g){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1000);$("select[id$=ddlOrderDate]").change(function(){a.fnDraw()});$("select[id$=ddlBuyer]").change(function(){a.fnDraw()});$("select[id$=ddlOrderStatus]").change(function(){a.fnDraw()});$("div[id$=divOrderStatusFilter]").show();AddHintText(dataTableResources.OrderPoNumber,"tblOrders")}function CreateOpenLinesDataTable(){if($("table#tblOpenOrders").length==0){return
|
|
}AddLinks();var a=$("table#tblOpenOrders").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/OpenOrders?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[1,"desc"]],oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sButtonText:dataTableResources.ExportPageToExcel,sFileName:dataTableResources.Mouser+dataTableResources.OpenOrders.replace(" ","")+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".csv",mColumns:[1,4,5,6,7,8,9,10,15],fnCellRender:function(c,b){return ExtractData(c,b,", ")
|
|
}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"DateCreated",bVisible:false,bSearchable:false},{mData:"SalesOrderDateDisplay",iDataSort:0,bSearchable:false,sWidth:"10%"},{mData:"SalesOrderNumber",bVisible:false,sWidth:"5%"},{mData:"WebOrderNumber",bVisible:false,sWidth:"5%"},{mData:"SalesOrderNumberDisplay",iDataSort:1,bSearchable:false},{mData:"WebOrderNumberDisplay",iDataSort:2,bSearchable:false},{mData:"PoNumber",iDataSort:3},{mData:"BuyerName",iDataSort:4,bSearchable:false,sWidth:"10%"},{mData:"OpenLines",iDataSort:5,bSearchable:false,sWidth:"5%"},{mData:"OpenTotalDisplay",iDataSort:6,bSearchable:false,sWidth:"5%"},{mData:"CurrencyCode",iDataSort:7,bSearchable:false,sWidth:"5%"},{mData:"OrderStatus",bVisible:false,bSearchable:false,sWidth:"10%"},{mData:"UpgradeShipSource",bVisible:false,bSearchable:false},{mData:"WaivedShipFlag",bVisible:false,bSearchable:false},{mData:"StatusToolTip",bVisible:false,bSearchable:false},{mData:"OrderStatusDisplay",iDataSort:8,bSearchable:false,sWidth:"15%"},{mData:"ShipmentNumber",bVisible:false,bSearchable:false},{mData:"ShipToCountry",bVisible:false,bSearchable:false},{mData:"PaymentGuid",bVisible:false,bSearchable:false},{mData:"PaymentMethodId",bVisible:false,bSearchable:false},{mData:"ActionItem",bSearchable:false,bSortable:false,sWidth:"15%"},{mData:"OpenTotal",bSearchable:false,bVisible:false}],fnHeaderCallback:function(f,g,e,c,b){$("#divStatusToolTip").remove();
|
|
if(g.length>0&&g[0].StatusToolTip&&g[0].StatusToolTip.length>0){$('<div id="divStatusToolTip" class="hidden">'+g[0].StatusToolTip+" </div>").appendTo("body")}},fnDrawCallback:function(e){if($("img.status-bar").length>0||$("img.red-dot").length>0){var c=$("img.status-bar:first").length+$("img.red-dot:first").length;var f="ShowStatusToolTip('"+c+"');";var b="HideStatusToolTip();";if($("img.status-help-icon").length==0){$('<img src="/Images/icon_tooltip.png" width="14" height="14" class="status-help-icon" onmouseover="'+f+'" onmouseout="'+b+'" />').appendTo(".dataTable th:nth(8) .DataTables_sort_wrapper")
|
|
}}else{$("img.status-help-icon").remove()}},oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",sEmptyTable:'<span class="error">'+dataTableResources.lblOrderHistoryNoOpenOrders+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},fnServerData:function(b,c,f,e){c.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()},{name:"buyerFilter",value:$("select[id$=ddlBuyer] option:selected").text()},{name:"buyerValue",value:$("select[id$=ddlBuyer] option:selected").val()},{name:"statusValue",value:$("select[id$=ddlOrderStatus] option:selected").val()});
|
|
e.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:b,data:c,success:f,error:function(g){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1000);$("select[id$=ddlOrderDate]").change(function(){a.fnDraw()});$("select[id$=ddlBuyer]").change(function(){a.fnDraw()});$("select[id$=ddlOrderStatus]").change(function(){a.fnDraw()});$("div[id$=divOrderStatusFilter]").show();AddHintText(dataTableResources.OrderPoNumber,"tblOpenOrders")}function CreateInvoiceDataTable(){if($("table#tblInvoices").length==0){return
|
|
}var a=$("table#tblInvoices").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Invoices?currencyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[1,"desc"]],oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sButtonText:dataTableResources.ExportPageToExcel,sFileName:dataTableResources.Mouser+dataTableResources.lblInvoices+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".csv",mColumns:"visible",fnCellRender:function(c,b){return ExtractData(c,b,", ")
|
|
}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"InvoiceDate",bVisible:false,bSearchable:false},{mData:"InvoiceDateDisplay",iDataSort:0,bSearchable:false,sWidth:"10%"},{mData:"InvoiceNumber",bVisible:false},{mData:"InvoiceNumberDisplay",iDataSort:1,bSearchable:false},{mData:"InvoiceTotal",bVisible:false,bSearchable:false},{mData:"InvoiceTotalDisplay",iDataSort:2,bSearchable:false},{mData:"OrderDate",bVisible:false,bSearchable:false},{mData:"SalesOrderDateDisplay",iDataSort:3,bSearchable:false,sWidth:"10%"},{mData:"SalesOrderNumber",bVisible:false},{mData:"WebOrderNumber",bVisible:false},{mData:"SalesOrderNumberDisplay",iDataSort:4,bSearchable:false},{mData:"WebOrderNumberDisplay",iDataSort:5,bSearchable:false},{mData:"CurrencyCode",iDataSort:6},{mData:"PoNumber",iDataSort:7,sWidth:"10%"},{mData:"BuyerName",iDataSort:8,bSearchable:false,sWidth:"15%"},{mData:"ShipToCountry",bVisible:false,bSearchable:false},{mData:"SoftwareParts",bVisible:false,bSearchable:false},{mData:"EmailAddress",bVisible:false,bSearchable:false},{mData:"ShippingMethodUvid",bVisible:false,bSearchable:false}],oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error">'+dataTableResources.lblOrderHistoryNoRecord3+"</span>",sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},fnServerData:function(b,c,f,e){c.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()},{name:"buyerFilter",value:$("select[id$=ddlBuyer] option:selected").text()},{name:"buyerValue",value:$("select[id$=ddlBuyer] option:selected").val()});
|
|
e.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:b,data:c,success:f,error:function(g,h){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1000);$("select[id$=ddlOrderDate]").change(function(){a.fnDraw()});$("select[id$=ddlBuyer]").change(function(){a.fnDraw()});AddHintText(dataTableResources.InvoiceOrderPoNumber,"tblInvoices")}function CreateOrderSearchDataTable(){if($("table#tblOrderSearch").length==0){return}AddLinks();var a=$("table#tblOrderSearch").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Search?currencyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',fnHeaderCallback:function(f,g,e,c,b){if(g.length>0&&$("a#lnkSelectAll").length==0){$('<a id="lnkSelectAll" title="'+dataTableResources.SelectAllToolTip+'" + href="javascript:void(0);">'+dataTableResources.btnSelectAll+"</a>").appendTo(".dataTable th:nth(0) .DataTables_sort_wrapper")
|
|
}$("a#lnkSelectAll").click(function(){SelectAllCheckboxes("tblOrderSearch")})},oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sButtonText:dataTableResources.ExportPageToExcel,sFileName:dataTableResources.Mouser+dataTableResources.btnSearch.replace(" ","")+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".csv",mColumns:[2,3,4,5,6,7,9,10,11,13,15,17,19],fnCellRender:function(c,b){return ExtractData(c,b,", ")}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mDataProp:null,sDefaultContent:"",bSortable:false,bSearchable:false,sWidth:"5%",sClass:"center"},{mData:"MouserPartNumber",bVisible:false},{mData:"MouserPartNumberDisplay",iDataSort:6,bSearchable:false},{mData:"CustomerPartNumber",iDataSort:7},{mData:"MFRPartNumber",iDataSort:8},{mData:"Manufacturer",iDataSort:9,sWidth:"10%"},{mData:"PartDescription",iDataSort:10,sWidth:"10%"},{mData:"Quantity",iDataSort:11},{mData:"UnitPrice",bVisible:false,bSearchable:false},{mData:"UnitPriceDisplay",iDataSort:12,bSearchable:false},{mData:"PONumber",iDataSort:13},{mData:"BuyerName",iDataSort:14,bSearchable:false},{mData:"UVSalesOrder_ID",bVisible:false},{mData:"SalesOrderNumberDisplay",iDataSort:15,bSearchable:false},{mData:"OrderDate",bVisible:false},{mData:"SalesOrderDateDisplay",iDataSort:16},{mData:"UVInvoice_ID",bVisible:false},{mData:"InvoiceNumberDisplay",iDataSort:17,bSearchable:false},{mData:"InvoiceDate",bVisible:false,bSearchable:false},{mData:"InvoiceDateDisplay",iDataSort:18,bSearchable:false},{mData:"ExtPrice",bVisible:false},{mData:"CurrencyCode",bVisible:false},{mData:"ShipToCountry",bVisible:false,bSearchable:false}],aoColumnDefs:[{fnRender:function(b){return'<input type="checkbox" data-partnumber="'+b.aData.MouserPartNumber+'" data-quantity="'+b.aData.Quantity+'">'
|
|
},aTargets:[0]}],oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},fnServerData:function(b,c,f,e){c.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()},{name:"buyerFilter",value:$("select[id$=ddlBuyer] option:selected").text()},{name:"buyerValue",value:$("select[id$=ddlBuyer] option:selected").val()},{name:"searchTerm",value:$("input[id$=txtSearch]").val()});
|
|
e.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:b,data:c,success:f,error:function(g,h){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1000);$("select[id$=ddlOrderDate]").change(function(){a.fnDraw()});$("select[id$=ddlBuyer]").change(function(){a.fnDraw()});AddHintText(dataTableResources.SearchHintText,"tblOrderSearch")}function CreateSavedCartsDataTable(){if($("table#tblSavedCarts").length==0){return}var b=$("table#tblSavedCarts").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/SavedCarts?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[16,"desc"]],fnHeaderCallback:function(g,h,f,e,c){if(h.length>0&&$("a#lnkSelectAll").length==0){$('<a id="lnkSelectAll" title="'+dataTableResources.SelectAllToolTip+'" + href="javascript:void(0);">'+dataTableResources.btnSelectAll+'</a><img width="14" height="14" class="status-help-icon" src="/Images/icon_tooltip.png" onclick="DisplayInfoModal(\''+dataTableResources.SelectAllHelp+"','"+dataTableResources.SelectCartHelp+"');\">").appendTo(".dataTable th:nth(5) .DataTables_sort_wrapper")
|
|
}$("a#lnkSelectAll").click(function(){SelectAllCheckboxes("tblSavedCarts")})},fnDrawCallback:function(c){$("div.floatright,hidden").removeClass("hidden");if(c.aoData.length==0){$("div.divOrderHistoryContainer a.blue-button,a.orange,a.gray2").addClass("disabled")}else{if(c.aoData.length==1){$("div.divOrderHistoryContainer a.orange").addClass("disabled");if(c.aoData[0]._aData.ActiveCart){$("div.divOrderHistoryContainer a.blue-button").addClass("disabled")}else{$("div.divOrderHistoryContainer a.blue-button").removeClass("disabled")
|
|
}$("div.divOrderHistoryContainer a.gray2").removeClass("disabled")}else{$("div.divOrderHistoryContainer a.blue-button,a.orange,a.gray2").removeClass("disabled")}}},oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sButtonText:dataTableResources.ExportPageToExcel,sFileName:dataTableResources.Mouser+"SharedCart"+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".csv",mColumns:[0,4,6,7,17],fnCellRender:function(e,c){return ExtractData(e,c,", ")}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"EditLink",iDataSort:0},{mData:"AccessId",bVisible:false,bSearchable:false,bSortable:false},{mData:"AccessIdDisplay",bVisible:false,bSearchable:false,bSortable:false},{mData:"DateCreated",bVisible:false,bSearchable:false},{mData:"DateCreatedDisplay",iDataSort:3,bSearchable:false},{mData:"LastUpdated",bVisible:false,bSearchable:false},{mData:"LastUpdatedDisplay",iDataSort:16,bSearchable:false},{mData:"OrderStatus",iDataSort:5,bSearchable:false},{mData:"DeleteLink",bVisible:false,bSearchable:false,bSortable:false},{mData:"ProjectGuid",bVisible:false,bSearchable:false,bSortable:false},{mData:"EditLink",bVisible:false,bSearchable:false,bSortable:false},{mData:"SharedLink",bVisible:false,bSearchable:false,bSortable:false},{mData:"ProjectLineCount",bVisible:false,bSearchable:false,bSortable:false},{mData:"DisableDropdown",bVisible:false,bSearchable:false,bSortable:false},{mData:"Archived",bVisible:false,bSearchable:false,bSortable:false},{mData:"IsSavedOrSharedCart",bVisible:false,bSearchable:false,bSortable:false},{mData:"CartGuid",bVisible:false,bSearchable:false,bSortable:false},{mData:"ProjectLineCount",iDataSort:10,bSearchable:false,},{mData:"ActiveCart",bVisible:false,bSearchable:false,bSortable:false},{mData:"HasScheduleReleases",bVisible:false,bSearchable:false,bSortable:false},{mDataProp:null,sDefaultContent:"",bSortable:false,bSearchable:false,sWidth:"12%",sClass:"center"}],oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error">'+dataTableResources.lblNoSavedCarts+"</span>",sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},aoColumnDefs:[{fnRender:function(c){return'<input type="checkbox" data-projectGuid="'+c.aData.AccessId+'" data-cartGuid="'+c.aData.CartGuid+'" data-activeCart="'+c.aData.ActiveCart+'">'
|
|
},aTargets:[20]}],fnServerData:function(c,e,g,f){e.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()});f.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:c,data:e,success:g,error:function(h,i){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1000);$("select[id$=ddlOrderDate]").change(function(){b.fnDraw()});AddHintText(dataTableResources.lblCartNameHeader,"tblSavedCarts");var a=GetSavedCartHelpModalValue();if(!a||a==="0"){DisplayCartHelpModal(true);
|
|
HideSavedCartsHelpModal()}}function GetSavedCartHelpModalValue(){var a=getPreferencesCookie();return a.SCH}function CreateSavedCart(b,a){$.ajax({url:"/api/OrderHistory/CreateSavedCart?cartGuid="+encodeURIComponent(b)+"&cartName="+encodeURIComponent(a),cache:false,type:"POST",timeout:15000,contentType:"application/json",success:function(c){window.location.href=c},error:function(){alert($("span[id$=litError]").html().trim())}})}function MakeCartActive(){if($("div.divOrderHistoryContainer a.blue-button").hasClass("disabled")){return
|
|
}var b=$(":checkbox:checked");if(!AreAnyChecked()){AddOrderHistoryGa("Error Message Pop-up","Make Active Error (None Selected)");DisplayInfoModal(dataTableResources.SelectCartToMakeActive,dataTableResources.MakeCartActive);return}if($(":checkbox:checked").length>1){AddOrderHistoryGa("Error Message Pop-up","Make Active Error (Multiple Selected)");DisplayInfoModal(dataTableResources.OneCartActive,dataTableResources.MakeCartActive);return}if(b.data("activecart")){AddOrderHistoryGa("Error Message Pop-up","Make Active Error (Active Cart Active)");
|
|
b.prop("checked",false);var a=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+dataTableResources.SelectedCartIsActive+"</p></div>");a.dialog({title:dataTableResources.MakeCartActive,resizable:false,modal:true,width:440,height:200,maxHeight:550,close:function(){$(this).dialog("destroy")},buttons:[{id:"submitHdr",text:dataTableResources.lblViewCart,"class":"ui-button",click:function(){$(this).dialog("destroy");window.location.href="/Cart"}}]});return}DisplayConfirmModal(dataTableResources.ConfirmActiveCart,dataTableResources.MakeCartActive,dataTableResources.MakeActive,ActivateCart,MakeCartActiveCancelGa)
|
|
}function MakeCartActiveCancelGa(){AddOrderHistoryGa("Make Cart Active Button","Cancel Make Active")}function DisplayCartHelpModal(a){var b=$('<div class="sc-help-modal"><p>'+dataTableResources.SavedCartsHelpContent+"</p></div>");b.dialog({title:dataTableResources.SavedSharedCartHelp,resizable:false,modal:true,width:600,height:455,maxHeight:550,beforeClose:function(){var c=($("div.helpSection-helpBox").scrollTop()>600?1:0);if(a){AddOrderHistoryGa("Active Cart Help","Welcome Help",c)}else{AddOrderHistoryGa("Active Cart Help","Button Help",c)
|
|
}},close:function(){$(this).dialog("destroy")}})}function HideSavedCartsHelpModal(){if(GetSavedCartHelpModalValue()==="1"){return}$.ajax({type:"POST",async:false,url:"/api/Preferences/HideSavedCartsHelpModal?sch=1",timeout:3000})}function DisplayConfirmModal(b,f,e,a,c){var g=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+b+"</p></div>");g.dialog({title:f,resizable:false,modal:true,width:440,height:200,maxHeight:550,close:function(){$(this).dialog("destroy");c()},buttons:[{id:"btnCancel",text:dataTableResources.btnCancel,click:function(){$(this).dialog("destroy");
|
|
c()}},{id:"btnConfirm",text:e,"class":"ui-button",click:function(){$(this).dialog("destroy");a()}}]})}function ActivateCart(){var a="";var b=$(":checkbox:checked");if(b.data("projectguid").toString().length>0&&b.data("projectguid")!="-"){a=b.data("projectguid")}else{if(b.data("cartguid").toString().length>0){a=b.data("cartguid")}}$.ajax({url:"/api/OrderHistory/MakeCartActive?guid="+encodeURIComponent(a),cache:false,type:"POST",timeout:30000,contentType:"application/json",success:function(){var e=$("table#tblSavedCarts").dataTable().fnGetData(b.parents("tr")[0]).DateCreated;
|
|
var c=e.split("T");AddOrderHistoryGa("Make Cart Active Button","Make Active",Daydiff(parseDate(c[0]),GetCurrentDate()));window.location.href="/Cart"},error:function(){alert($("span[id$=litError]").html().trim())}})}function AddOrderHistoryGa(b,a,c){GaEvent("Order History Page",b,a,c)}function parseDate(b){var a=b.split("-");return new Date(a[0],a[1]-1,a[2])}function Daydiff(b,a){return(a-b)/(1000*60*60*24)}function GetCurrentDate(){var e=new Date();var f=e.getFullYear();var a=e.getDate();var b=(f)+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+a).slice(-2);
|
|
var c=new String(b).split("-");return new Date(c[0],c[1]-1,c[2])}function DeleteCartsConfirm(){if($("div.divOrderHistoryContainer a.gray2").hasClass("disabled")){return}if(!AreAnyChecked()){AddOrderHistoryGa("Error Message Pop-up","Delete Error (None Selected)");DisplayInfoModal(dataTableResources.SelectCartToDelete,dataTableResources.btnDeleteCart);return}var c="";var a=dataTableResources.btnDeleteCart;var e=$(":checkbox:checked");var b="";e.each(function(){if($(this).data("activecart")){b=true}});if(b){c=dataTableResources.WarningCartLost
|
|
}else{if(e.length>1){c=dataTableResources.ConfirmDeleteCarts;a=dataTableResources.DeleteCarts}else{c=dataTableResources.ConfirmDeleteCart}}DisplayConfirmModal(c,dataTableResources.btnDeleteCart,a,DeleteCarts,DeleteCartsCancelGa)}function DeleteCartsCancelGa(){AddOrderHistoryGa("Delete Cart Button","Cancel")}function GetCartAndProjectList(){var e=$(":checkbox:checked");var a=[];var c=[];var b={};b.HasActiveCart=false;e.each(function(){if($(this).data("activecart")){b.HasActiveCart=true}if($(this).data("projectguid").toString().length>0&&$(this).data("projectguid")!="-"){c.push($(this).data("projectguid"))
|
|
}else{if($(this).data("cartguid").toString().length>0){a.push($(this).data("cartguid"))}}});b.ProjectList=c;b.CartList=a;return b}function DeleteCarts(){var a=GetCartAndProjectList();$.ajax({url:"/api/OrderHistory/DeleteCarts",cache:false,type:"POST",timeout:30000,contentType:"application/json",data:JSON.stringify(a),success:function(){var b=((a.ProjectList.length+a.CartList.length)>1?"Multiple Delete":"Single Delete");AddOrderHistoryGa("Delete Cart Button",b);$("table#tblSavedCarts").dataTable().fnReloadAjax();
|
|
if(a.HasActiveCart){MiniCart.SetStringNMsgForMiniCart(0,0);MiniCart.CreateMiniCart(true);MiniCart.TotalDisplayRecords=0}},error:function(){alert($("span[id$=litError]").html().trim())}})}function MergeCartsConfirm(){if($("div.divOrderHistoryContainer a.orange").hasClass("disabled")){return}if(!AreAnyChecked()||$(":checkbox:checked").length<2){AddOrderHistoryGa("Error Message Pop-up","Merge Carts Error (None/One Selected)");DisplayInfoModal(dataTableResources.TwoMergeCarts,dataTableResources.MergeCarts);return
|
|
}DisplayConfirmModal(dataTableResources.ConfirmMergeCarts,dataTableResources.MergeCarts,dataTableResources.MergeCarts,MergeCarts,MergeCartsCancelGa)}function MergeCartsCancelGa(){AddOrderHistoryGa("Merge Carts Button","Cancel Merge Carts")}function MergeCarts(){var b=setTimeout(function(){$("a#lnkloader").click()},1500);var a=GetCartAndProjectList();$.ajax({url:"/api/OrderHistory/MergeCarts?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),cache:false,type:"POST",timeout:120000,contentType:"application/json",data:JSON.stringify(a),success:function(){AddOrderHistoryGa("Merge Carts Button","Merge Carts",(a.ProjectList.length+a.CartList.length));
|
|
window.clearTimeout(b);$.colorbox.close();$("table#tblSavedCarts").dataTable().fnReloadAjax()},error:function(){$.colorbox.close();alert($("span[id$=litError]").html().trim())}})}function CreateProjectsDataTable(){if($("table#tblProjects").length==0){return}var a=$("table#tblProjects").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Projects?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[3,"desc"]],oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sButtonText:dataTableResources.ExportPageToExcel,sFileName:dataTableResources.Mouser+dataTableResources.lbProject.replace(" ","")+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".csv",mColumns:[0,1,3,4],fnCellRender:function(c,b){return ExtractData(c,b,", ")
|
|
}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"EditLink",iDataSort:0},{mData:"ProjectLineCount",iDataSort:10,bSearchable:false,},{mData:"DateCreated",bVisible:false,bSearchable:false},{mData:"DateCreatedDisplay",iDataSort:3,bSearchable:false},{mData:"AccessId",bSortable:false},{mData:"ArchiveLink",bSearchable:false,bSortable:false},{mData:"SharedLink",bSearchable:false,bSortable:false,sWidth:"5%"},{mData:"DeleteLink",bSearchable:false,bSortable:false,sWidth:"5%"},{mData:"OrderStatus",bVisible:false,bSearchable:false,bSortable:false},{mData:"ProjectGuid",bVisible:false,bSearchable:false,bSortable:false},{mData:"DisableDropdown",bVisible:false,bSearchable:false,bSortable:false},{mData:"Archived",bVisible:false,bSearchable:false,bSortable:false},{mData:"IsSavedOrSharedCart",bVisible:false,bSearchable:false,bSortable:false},{mData:"CartGuid",bVisible:false,bSearchable:false,bSortable:false},{mData:"ActiveCart",bVisible:false,bSearchable:false,bSortable:false},{mData:"LastUpdated",bVisible:false,bSearchable:false,bSortable:false},{mData:"HasScheduleReleases",bVisible:false,bSearchable:false,bSortable:false}],oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error">'+dataTableResources.lblProjects+"</span>",sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},fnDrawCallback:function(b){if(b.aoData.length==0||b.aoData[0]._aData.DisableDropdown){$("select[id$=ddlProjectArchive]").val("-1");
|
|
$("select[id$=ddlProjectArchive]").attr("disabled","disabled")}else{$("select[id$=ddlProjectArchive]").removeAttr("disabled")}$("a.pm-delete").click(function(){AddPmGoogleAnalyticsEvents("Delete Open","Homepage");var e=$(this);var c=e.data("guid");var f=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+dataTableResources.ConfirmDelete.format(dataTableResources.lblProject)+"</p></div>");f.dialog({title:dataTableResources.btnDeleteProject,resizable:false,modal:true,width:440,height:200,maxHeight:550,close:function(){$(this).dialog("destroy")
|
|
},buttons:[{id:"btnCancel",text:dataTableResources.btnCancel,click:function(){$(this).dialog("destroy")}},{id:"btnConfirm",text:dataTableResources.btnDeleteProject,"class":"ui-button",click:function(){DeleteProject($(this),a,e,c)}}]})});$("a.pm-share").click(function(){$.ajax({url:"/api/OrderHistory/ShareProject?projectGuid="+$(this).data("guid"),cache:false,timeout:20000,type:"POST",success:function(c){window.location.href=c},error:function(){}})});$("a.blue-button,a.btn.gray2").click(function(){ShowArchiveProjectModal(a,$(this).data("guid"),($(this).data("archive")=="True"),"Homepage",dataTableResources.ArchiveThisProject,dataTableResources.ActivateThisProject,dataTableResources.ArchiveProject,dataTableResources.btnCancel,dataTableResources.ArchiveProject,dataTableResources.ActivateProject,dataTableResources.lblCommErrorTitle)
|
|
})},fnServerData:function(b,c,f,e){c.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()},{name:"projectFilter",value:$("select[id$=ddlProjectArchive] option:selected").val()});e.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:b,data:c,success:f,error:function(g,h){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1000);$("select[id$=ddlOrderDate]").change(function(){a.fnDraw()});$("select[id$=ddlProjectArchive]").change(function(){a.fnDraw()
|
|
});$("div[id$=divProjectArchiveFilter]").show();AddHintText(dataTableResources.ProjectNameAccessID,"tblProjects");$("input[id$=btnNewProject]").click(function(){var b=$("select[id$=ddlLocation]").val();if(IsValidGuid(b)){AddPmGoogleAnalyticsEvents("New Project from Existing","Homepage")}else{AddPmGoogleAnalyticsEvents("New Project","Homepage")}return true})}function CreateQuotesDataTable(){if($("table#tblQuotes").length==0){return}var a=$("table#tblQuotes").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Quotes?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',fnHeaderCallback:function(b,c){if(c.length>0&&$("a#lnkSelectAll").length==0){$('<a id="lnkSelectAll" title="'+dataTableResources.SelectAllToolTip+'" + href="javascript:void(0);">'+dataTableResources.btnSelectAll+"</a>").appendTo(".dataTable th:nth(0) .DataTables_sort_wrapper")
|
|
}$("a#lnkSelectAll").click(function(){SelectAllCheckboxes("tblQuotes")})},fnDrawCallback:function(){if(a.fnSettings().fnRecordsTotal()<=0&&window.location.href.indexOf("qs")=="-1"){$("span[id$=lblQuotesDetails]").hide();if($("select[id$=ddlOrderDate] option:selected").index()>0||$("select[id$=ddlBuyer] option:selected").index()>0){$("div[id$=divQuoteSearch]").hide();$("#divSearchGrid").show()}else{$("div[id$=divQuoteSearch]").show();$("#divSearchGrid").hide()}}else{$("#divSearchGrid").show();$("span[id$=lblQuotesDetails]").show();
|
|
$("div[id$=divQuoteSearch]").hide()}},aaSorting:[[2,"desc"]],oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sButtonText:dataTableResources.ExportPageToExcel,sFileName:dataTableResources.Mouser+dataTableResources.Quotes+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".xls",mColumns:[1,2,3,4,5,6,7],fnCellRender:function(c,b){return ExtractData(c,b,", ")}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mDataProp:null,sDefaultContent:"",bSortable:false,bSearchable:false,sClass:"center"},{mData:"DateCreated",bVisible:false,bSearchable:false},{mData:"DateCreatedDisplay",iDataSort:0,bSearchable:false},{mData:"QuoteNumber",bVisible:false},{mData:"QuoteNumberDisplay",bSearchable:false,iDataSort:2},{mData:"ReferenceNumber",iDataSort:4},{mData:"BuyerName",bSearchable:false,iDataSort:5},{mData:"ProductCount",bSearchable:false,iDataSort:6},{mData:"SalesRep",bSearchable:false,bSortable:false},{mData:"Status",bSearchable:false,iDataSort:8}],aoColumnDefs:[{fnRender:function(b){if(b.aData.ValidCurrency){return'<input type="checkbox" class="chk-quote" data-guid="'+b.aData.Guid+'" data-quotenumber="'+b.aData.QuoteNumber+'">'
|
|
}return""},aTargets:[0]}],oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},fnServerData:function(b,c,f,e){c.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()},{name:"buyerFilter",value:$("select[id$=ddlBuyer] option:selected").text()},{name:"buyerValue",value:$("select[id$=ddlBuyer] option:selected").val()});
|
|
e.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:b,data:c,success:f,error:function(g,h){$(".dataTables_processing").css("visibility","hidden");if(g.responseText&&g.responseText.indexOf("Invalid querystring count")>-1){window.location.href="/OrderHistory/OrderHistoryLogin.aspx"}}})}}).fnSetFilteringDelay(1000);$("select[id$=ddlOrderDate]").change(function(){a.fnDraw()});$("select[id$=ddlBuyer]").change(function(){a.fnDraw()});AddHintText(dataTableResources.QuoteSearchText,"tblQuotes")
|
|
}function ExtractData(o,h,l){if(Number(o)==o){return o}var a=o.indexOf("href");var r=o.indexOf("return false");var q=o.indexOf("divStatus");var m=o.indexOf("javascript");var p=o.indexOf("<br />");var c=o.indexOf("span");if(a>0||h==21||h==24){if(h==21||h==24){var k=o.split("<br />");RemoveEmptyArrayItems(k);var g="";for(var f=0;f<k.length;f++){if(a>0){g+=k[f].substring(k[f].indexOf(">")+1,k[f].indexOf("</a>"))}else{g+=k[f]}if(k[f].length>0&&g!="-"&&(k.length-1)>f){g+=l}}o=g}else{o=o.substring(o.indexOf(">")+1,o.indexOf("</a>"))
|
|
}}else{if(r>0){o=o.substring(r+15,o.length).replace("</a>","");var b=o.indexOf(" ");if(b>0){o=o.replace(o.substring(b,o.length),"")}}else{if(q>0){o=o.substring(q+11,o.length).replace("</div>","");var n=o.indexOf("<img");if(n>0){o=o.replace(o.substring(n,o.length),"")}}else{if(m>0){o=""}else{if(p>0){k=o.split("<br />");RemoveEmptyArrayItems(k);g="";for(var e=0;e<k.length;e++){g+=k[e];if(k[e].length>0&&(k.length-1)>e){g+=l}}o=g}else{if(c>0){o=o.substring(c+19,o.length).replace("</span>","")}}}}}}return o.replace("<br />","")
|
|
}function RemoveEmptyArrayItems(b){var a=b.indexOf("");if(a>-1){b.splice(a,1)}}function ReorderSelectedItems(a){if(!AreAnyChecked()){alert(a)}else{$(".dataTables_processing").css("visibility","visible");var b={};$("table#tblOrderSearch input:checked").each(function(){var e=$(this).data("quantity");var c=$(this).data("partnumber");if(b[c]){b[c]=b[c]+e}else{b[c]=e}});$.ajax({url:"/api/OrderHistory/ReorderSelectedItems",cache:false,type:"POST",timeout:30000,contentType:"application/json",data:JSON.stringify(b),success:function(){window.location.href="/Cart"
|
|
},error:function(){alert($("span[id$=litError]").html().trim());$(".dataTables_processing").css("visibility","hidden")}})}}function AddHintText(a,b){$("div#"+b+"_filter").parent().find("input").attr("class","hint");$("div#"+b+"_filter").parent().find("input").attr("title",a)}function EmailSelectedQuotes(){if($(".chk-quote:checked").length==0){alert(dataTableResources.litSelectQuotes);return}var a=[];$(".chk-quote:checked").each(function(){a.push($(this).data("quotenumber"))});$.ajax({url:"/api/OrderHistory/GetEncryptedQuoteIds",cache:false,type:"POST",timeout:15000,contentType:"application/json",data:JSON.stringify(a),success:function(b){$("a#lnkEmailQuote").attr("href","/OrderHistory/EmailQuotes.aspx?qs="+b+"&TB_iframe=true&height=250&width=450&modal=true");
|
|
$("a#lnkEmailQuote").click()},error:function(){alert($("span[id$=litError]").html().trim())}})}function BuySelectedQuotes(){if($(".chk-quote:checked").length==0){alert(dataTableResources.litSelectQuotesBuy);return}$("a#lnkloader").click();var a=[];$(".chk-quote:checked").each(function(){a.push($(this).data("guid"))});$.ajax({url:"/api/OrderHistory/BuySelectedQuotes",cache:false,type:"POST",timeout:30000,contentType:"application/json",data:JSON.stringify(a),success:function(){window.location.href="/Cart"},error:function(){tb_remove();
|
|
alert($("span[id$=litError]").html().trim())}})}function CreateBomDataTable(){if($("table#tblBoms").length==0){return}$("a#lnkCreateNewBom").click(function(){$.ajax({url:"/OrderHistory/CreateNewBom",cache:false,type:"GET",success:function(c){var b=$("div.error-container");if(c.ErrorMessage.length>0){if(b.hasClass("hidden")){$("p#pErrorMessage").replaceWith(c.ErrorMessage);b.toggleClass("hidden");if($.scrollTo){$.scrollTo(b,1000,{easing:"easeInCubic",axis:"y"})}}}else{window.location=c.ReturnUrl}},error:function(){}})
|
|
});var a=$("table#tblBoms").dataTable({bProcessing:true,bAutoWidth:false,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:true,bJQueryUI:true,bDeferRender:true,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Boms?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[2,"desc"]],oTableTools:{sSwfPath:"/Content/DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",aButtons:[{sExtends:"xls",sButtonText:dataTableResources.ExportPageToExcel,sFileName:dataTableResources.Mouser+"BOMs"+hrs+d.getMinutes()+(hrs>11?"PM":"AM")+".csv",mColumns:[0,1,2,3,4],fnCellRender:function(c,b){return ExtractData(c,b,", ")
|
|
}},{sExtends:"print",bShowAll:false,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"BomNameDisplay",iDataSort:8,bSearchable:false,sWidth:"20%",sClass:"bomname-col"},{mData:"Status",bSortable:false,sWidth:"10%",bSearchable:false},{mData:"DateCreatedDisplay",iDataSort:11,bSearchable:false,sWidth:"10%"},{mData:"DateExpiresDisplay",iDataSort:25,bSearchable:false,sWidth:"10%"},{mData:"LinesQuoted",iDataSort:27,bSearchable:false,sWidth:"8%"},{mData:"BuyLink",bSortable:false,bSearchable:false,sWidth:"15%"},{mData:"ExportLink",bSortable:false,bSearchable:false,sWidth:"8%"},{mData:"DeleteLink",bSortable:false,bSearchable:false,sWidth:"8%"}],oLanguage:{sProcessing:'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error">'+dataTableResources.NoBomsForAccount+"</span>",sZeroRecords:'<span class="error">'+dataTableResources.lblNoResultsFilter+"</span>",oPaginate:{sFirst:"<span></span>",sLast:"<span></span>"},sLengthMenu:pageText,sSearch:dataTableResources.btnSearch,sInfo:pagingText,sInfoFiltered:dataTableResources.FilteredFrom.replace("{0}","_MAX_")},fnDrawCallback:function(){$("a.delete-bom").click(function(){ConfirmDeleteBom(a,$(this).data("bomid"))
|
|
});$("a.cancel-bom").click(function(){ConfirmCancelBom(a,$(this).data("bomid"))})},fnServerData:function(b,c,f,e){e.jqXHR=$.ajax({dataType:"json",type:"POST",cache:false,timeout:30000,url:b,data:c,success:f,error:function(g,h){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1000);AddHintText(dataTableResources.BomSearchText,"tblBoms")}function ConfirmCancelBom(a,b){var c=$('<div><div class="bold alert alert-warning"><p>'+dataTableResources.CancelYourBom+"</p></div></div>");c.dialog({modal:true,title:dataTableResources.CancelBomConfirm,draggable:false,dialogClass:"cancel-bom",width:GetResponsiveModalWidth(500),height:GetResponsiveModalHeight(200),close:function(){$(this).dialog("destroy")
|
|
},buttons:[{id:"btnCancel",text:dataTableResources.No,"class":"ui-button",click:function(){$(this).dialog("destroy")}},{id:"btnConfirm",text:dataTableResources.lblYes,"class":"ui-button",click:function(){$(this).dialog("destroy");$.ajax({url:"/api/OrderHistory/DeleteBomById?bomId="+encodeURIComponent(b),cache:false,timeout:20000,type:"POST",success:function(e){a.fnDeleteRow($(this).parents("tr"));if(e.length>0&&$("div.error-container").hasClass("hidden")){$("label#lblAcctMessage").before(e)}},error:function(){HandleError($("div.ui-dialog.cancel-bom"))
|
|
}})}}]})}function ConfirmDeleteBom(a,b){var c=$('<div><div class="bold alert alert-warning"><p>'+dataTableResources.ConfirmDeleteBom+"</p></div></div>");c.dialog({modal:true,title:dataTableResources.DeleteBomConfirmation,draggable:false,dialogClass:"delete-bom",width:GetResponsiveModalWidth(500),height:GetResponsiveModalHeight(200),close:function(){$(this).dialog("destroy")},buttons:[{id:"btnCancel",text:dataTableResources.btnCancel,"class":"ui-button",click:function(){$(this).dialog("destroy")}},{id:"btnConfirm",text:dataTableResources.confirm,"class":"ui-button",click:function(){$(this).dialog("destroy");
|
|
$.ajax({url:"/api/OrderHistory/DeleteBomById?bomId="+encodeURIComponent(b),cache:false,timeout:20000,type:"POST",success:function(e){a.fnDeleteRow($(this).parents("tr"));if(e.length>0&&$("div.error-container").hasClass("hidden")){$("label#lblAcctMessage").before(e)}},error:function(){HandleError($("div.ui-dialog.delete-bom"))}})}}]})}function HandleError(a){a.find("div.alert-warning").removeClass("alert-warning").addClass("alert-danger");a.find("div.alert-danger p").html(dataTableResources.CouldNotProcessRequest);
|
|
a.find("button#btnConfirm").hide();a.find("button#btnCancel").text(dataTableResources.btnBack)}function DeleteProject(c,e,b,a){$.ajax({url:"/api/OrderHistory/DeleteProjectByGuid?projectGuid="+encodeURIComponent(a),cache:false,timeout:20000,type:"POST",success:function(){c.dialog("destroy");AddPmGoogleAnalyticsEvents("Delete Confirm","Homepage");e.fnDeleteRow(b.parents("tr"))},error:function(){}})}function DisplayInfoModal(a,b){var c=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+a+"</p></div>");
|
|
c.dialog({title:b,resizable:false,modal:true,width:440,height:200,maxHeight:550,close:function(){$(this).dialog("destroy")},buttons:[{id:"btnConfirm",text:dataTableResources.lnkClose,"class":"ui-button",click:function(){$(this).dialog("destroy")}}]})}jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay=function(f,b){try{var a=this;if(b===undefined){b=250}this.each(function(g){$.fn.dataTableExt.iApiIndex=g;var e=null,j=null,h=$("input",a.fnSettings().aanFeatures.f);h.unbind("keyup").bind("keyup",function(){if(j===null||j!=h.val()){window.clearTimeout(e);
|
|
j=h.val();e=window.setTimeout(function(){$.fn.dataTableExt.iApiIndex=g;a.fnFilter(h.val())},b)}});return this});return this}catch(c){return null}};$.extend($.fn.dataTableExt.oStdClasses,{sPageEllipsis:"paginate_ellipsis",sPageNumber:"paginate_number",sPageNumbers:"paginate_numbers"});$.fn.dataTableExt.oPagination.ellipses={oDefaults:{iShowPages:5},fnClickHandler:function(f){var b=f.data.fnCallbackDraw,c=f.data.oSettings,a=f.data.sPage;if($(this).is("[disabled]")){return false}c.oApi._fnPageChange(c,a);b(c);if(a!=="first"&&a!=="last"){a+=1
|
|
}if(c.nTable.id==="tblMiniCart"){if(typeof cartTable.itemsToShow===typeof undefined||cartTable.itemsToShow==null){ga("send","event","Cart Hover","Paging",a,MiniCart.TotalDisplayRecords)}else{ga("send","event","Add to Cart Modal","Paging",a,MiniCart.TotalDisplayRecords)}}return true},fnInit:function(e,m,k){var a=e.oClasses,n=e.oLanguage.oPaginate,j=this;var b=e.oInit.iShowPages||this.oDefaults.iShowPages,l=Math.floor(b/2);$.extend(e,{_iShowPages:b,_iShowPagesHalf:l,});var f=$('<a class="'+a.sPageButton+" "+a.sPageFirst+'">'+n.sFirst+"</a>"),g=$('<a class="'+a.sPageButton+" "+a.sPagePrevious+'">'+n.sPrevious+"</a>"),h=$('<span class="'+a.sPageNumbers+'"></span>'),c=$('<a class="'+a.sPageButton+" "+a.sPageNext+'">'+n.sNext+"</a>"),i=$('<a class="'+a.sPageButton+" "+a.sPageLast+'">'+n.sLast+"</a>");
|
|
f.click({fnCallbackDraw:k,oSettings:e,sPage:"first"},j.fnClickHandler);g.click({fnCallbackDraw:k,oSettings:e,sPage:"previous"},j.fnClickHandler);c.click({fnCallbackDraw:k,oSettings:e,sPage:"next"},j.fnClickHandler);i.click({fnCallbackDraw:k,oSettings:e,sPage:"last"},j.fnClickHandler);$(m).append(f,g,h,c,i)},fnUpdate:function(b,j){var a=b.oClasses,g=this;var l=b.nTableWrapper;this.fnUpdateState(b);if(b._iCurrentPage===1){$(".first",l).addClass("ui-state-disabled");$("."+a.sPagePrevious,l).attr("disabled",true)
|
|
}else{$(".first",l).removeClass("ui-state-disabled");$("."+a.sPagePrevious,l).removeAttr("disabled")}if(b._iTotalPages===0||b._iCurrentPage===b._iTotalPages){$("."+a.sPageNext,l).attr("disabled",true);$(".last",l).addClass("ui-state-disabled")}else{$("."+a.sPageNext,l).removeAttr("disabled");$(".last",l).removeClass("ui-state-disabled")}var e,h,c=$("."+a.sPageNumbers,l);c.html("");for(e=b._iFirstPage;e<=b._iLastPage;e++){h=$('<a class="'+a.sPageButton+" "+a.sPageNumber+'">'+b.fnFormatNumber(e)+"</a>");if(b._iCurrentPage===e){h.attr("active",true).attr("disabled",true)
|
|
}else{h.click({fnCallbackDraw:j,oSettings:b,sPage:e-1},g.fnClickHandler)}c.append(h)}var k="";var f="";if(1<b._iFirstPage){k=(b._iCurrentPage-6);if(k<0){k=0}f=$('<a class="'+a.sPageButton+" "+k+'">...</a>').click({fnCallbackDraw:j,oSettings:b,sPage:k},g.fnClickHandler);c.prepend(f)}k=(b._iCurrentPage+4);if(b._iLastPage<b._iTotalPages){if(k>=b._iTotalPages){k=(b._iTotalPages-1)}f=$('<a class="'+a.sPageButton+" "+k+'">...</a>').click({fnCallbackDraw:j,oSettings:b,sPage:k},g.fnClickHandler);c.append(f)}},fnUpdateState:function(e){var b=Math.ceil((e._iDisplayStart+1)/e._iDisplayLength),f=Math.ceil(e.fnRecordsDisplay()/e._iDisplayLength),c=b-e._iShowPagesHalf,a=b+e._iShowPagesHalf;
|
|
if(f<=1){$("table#"+e.sTableId).next().find(".dataTables_paginate").hide()}else{$("table#"+e.sTableId).next().find(".dataTables_paginate").show()}if(f<e._iShowPages){c=1;a=f}else{if(c<1){c=1;a=e._iShowPages}else{if(a>f){c=(f-e._iShowPages)+1;a=f}}}$.extend(e,{_iCurrentPage:b,_iTotalPages:f,_iFirstPage:c,_iLastPage:a})}};jQuery.fn.dataTableExt.oApi.fnReloadAjax=function(h,e,i,c){if(jQuery.fn.dataTable.versionCheck){var f=new jQuery.fn.dataTable.Api(h);if(e){f.ajax.url(e).load(i,!c)}else{f.ajax.reload(i,!c)}return
|
|
}if(e!==undefined&&e!==null){h.sAjaxSource=e}if(h.oFeatures.bServerSide){this.fnDraw();return}this.oApi._fnProcessingDisplay(h,true);var g=this;var a=h._iDisplayStart;var b=[];this.oApi._fnServerParams(h,b);h.fnServerData.call(h.oInstance,h.sAjaxSource,b,function(l){g.oApi._fnClearTable(h);var j=(h.sAjaxDataProp!=="")?g.oApi._fnGetObjectDataFn(h.sAjaxDataProp)(l):l;for(var k=0;k<j.length;k++){g.oApi._fnAddData(h,j[k])}h.aiDisplay=h.aiDisplayMaster.slice();g.fnDraw();if(c===true){h._iDisplayStart=a;g.oApi._fnCalculateEnd(h);
|
|
g.fnDraw(false)}g.oApi._fnProcessingDisplay(h,false);if(typeof i=="function"&&i!==null){i(h)}},h)}; |