Files
Last update 2 months 4 days
by
Arnaud-Apu-Fanovard
DataTables.js.téléchargement$(document).ready(function(){try{CreateOrderHistoryDataTable(),CreateInvoiceDataTable(),CreateOpenLinesDataTable(),CreateOrderSearchDataTable(),CreateSavedCartsDataTable(),CreateProjectsDataTable(),CreateNewProjectsDataTable(),CreateQuotesDataTable(),CreateQuotesDataTableMVC(),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()}catch{$(".dataTables_processing").css("visibility","hidden")}});var adminIcon=function(e,t){return t==="display"&&typeof Resources!="undefined"?e.replace("{0}",' <i class="fa fa-shield-check" aria-hidden="true" title="'+Resources.MyMouser.ShieldIcon+'"></i> '):e},multiRowCellRender=function(e){return typeof modifyMultiRowCell=="function"?modifyMultiRowCell(e):e};function ajax_download(e,t,n){t=t.replace(/(\r\n|\r|\n)/g,"~~!!~~");var s,o,i,a,r=typeof dataTablesOverrides!="undefined"?dataTablesOverrides:{};(o=$("#download_iframe")).length===0&&(o=$("<iframe id='download_iframe' style='display: none' src='about:blank'></iframe>").appendTo("body")),$("#download_iframe").on("load",function(){$("#download_iframe").remove()}),s=o[0].contentWindow||o[0].contentDocument,s.document&&(s=s.document),a="<html><head></head><body>"+e+"</body></html>",s.open(),s.write(a),r.useNewCode&&(i=document.createElement("div"),i.innerHTML=t,t=i.innerText.replaceAll(` `,` `)),$("#ExportToExcelData",s).val(encodeURIComponent(t)),$("#ExportToExcelName",s).val(encodeURIComponent(n)),$(s).find("form").trigger("submit")}function AddLinks(){$("div.floatleft.padding10leftright").hide();var s,o,i,a,e="",t="",n="",r=$("select[id$=ddlOhNavigation] option").length;return r>3?(e=$("select[id$=ddlOhNavigation] option:nth(1)").html(),t=$("select[id$=ddlOhNavigation] option:nth(2)").html(),n=$("select[id$=ddlOhNavigation] option:nth(3)").html()):(e=$("select[id$=ddlOhNavigation] option:nth(0)").html(),t=$("select[id$=ddlOhNavigation] option:nth(1)").html(),n=$("select[id$=ddlOhNavigation] option:nth(2)").html()),$("table#tblOrders").length==0&&(t="<a id='lnkAllOrders' href='/OrderHistory/OrdersView.aspx'><b>"+t+"</b></a>"),$("table#tblOpenOrders").length==0&&(e="<a id='lnkOpenOrders' href='/OrderHistory/OpenLinesView.aspx'><b>"+e+"</b></a>"),$("table#tblOrderSearch").length==0&&(n="<a href='/OrderHistory/SearchView.aspx'><b>"+n+"</b></a>"),o=e,i=t,a=n,s='<div class="padding10"><b>'+$("div.floatleft.padding10leftright").contents("b").html()+"</b> "+o+" | "+i+" | "+a+"</div>",$("div#divOrderHistoryToolTip").length>0?$("div#divOrderHistoryToolTip").after(s):$("#divOHFilterLegendWrapper").before(s),$("table#orderHistorySearchTable a#lnkOpenOrders").on("click",function(){dataLayer!==void 0&&dataLayer.push({event:"order_history_search_view_open_orders_clicked"})}),$("table#orderHistorySearchTable a#lnkAllOrders").on("click",function(){dataLayer!==void 0&&dataLayer.push({event:"order_history_search_view_all_orders_clicked"})}),!0}function noOrdersOrTimeout(e,t){if(dataLayer!==void 0&&dataLayer.push({event:t}),!e){HideOrderHistoryTable();return}$.get("/OrderHistory/OrderSearch",function(e){if(e==="NotLoggedIn")window.location.reload();else{var n=!0,t=$.parseHTML(e,n);document.querySelector("#gridAlertsContainer")?$("#gridAlertsContainer").append(t):$("#divNoOrders").append(t),typeof OrderSearch!="undefined"&&OrderSearch.setupSearchButton(),RebindJQueryValidation()}HideOrderHistoryTable()})}function showManagePermissions(e,t){if(!e||document.querySelector("#OrderSearchPanel")){HideOrderHistoryTable(!0);return}$.get("/OrderHistory/OrderSearch",function(e){if(e==="NotLoggedIn")window.location.reload();else{var n=!0,t=$.parseHTML(e,n);typeof dataTablesOverrides!="undefined"&&dataTablesOverrides.useNewCode?$("#gridAlertsContainer").append(t):$("#divOrgManagePermission").append(t),typeof OrderSearch!="undefined"?OrderSearch.setupSearchButton("order_history_orders_no_info_search_orders_clicked"):typeof PartSearch!="undefined"?PartSearch.setupSearchButton():typeof InvoicesIndex!="undefined"&&InvoicesIndex.setupSearchButton(),RebindJQueryValidation()}HideOrderHistoryTable(!0)}),dataLayer!==void 0&&dataLayer.push({event:t})}function HideOrderHistoryTable(e){showManagePermissions===void 0&&(e=!1),$("#divOrderHistoryGrid").addClass("hidden"),$("#divOHFilterLegendWrapper").addClass("hidden"),$("#divOHFilterLegendWrapperMVC").addClass("hidden"),e?($("#divOrgManagePermission").removeClass("hidden"),$("#btnSendOpenOrdersReport").prop("disabled",!0),$("#lnkSndStatement").prop("disabled",!0)):$("#divNoOrders").removeClass("hidden")}function showInvoicesManagePermissions(){$("#divOrgManagePermission").removeClass("hidden"),$("#divOrderHistoryGrid").addClass("hidden"),$("#divOHFilterLegendWrapper").addClass("hidden")}function showQuotesManagePermissions(){$("#divOrgManagePermission").removeClass("hidden"),$("#divSearchGrid").addClass("hidden"),$("#divOHFilterLegendWrapper").addClass("hidden")}function CreateOrderHistoryDataTable(){if($("table#tblOrders").length==0)return;var a,e=!0,i=!1,n=noOrdersOrTimeout,r=showManagePermissions,s=typeof dataTablesOverrides!="undefined"?dataTablesOverrides:{},t="order_history_orders_no_info",o=$("table#tblOrders").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Orders?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[1,"desc"]],oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:[1,4,5,6,7,15,21,22,23,24,25],fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,dataTableResources.AllOrders.replace(" ",""))}})},fnCellRender:function(e,t){return ExtractData(e,t,", ")}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"DateCreated",bVisible:!1,bSearchable:!1},{mData:"SalesOrderDateDisplay",iDataSort:0,bSearchable:!1,sWidth:"10%",bExportable:!0},{mData:"SalesOrderNumber",bVisible:!1},{mData:"WebOrderNumber",bVisible:!1},{mData:"SalesOrderNumberDisplay",iDataSort:1,bSearchable:!1},{mData:"WebOrderNumberDisplay",iDataSort:2,bSearchable:!1},{mData:"PoNumber",iDataSort:3,sWidth:"12%"},{mData:"BuyerName",iDataSort:4,bSearchable:!1,sWidth:"12%",mRender:adminIcon},{mData:"OpenLines",bVisible:!1,bSearchable:!1},{mData:"OpenTotal",bVisible:!1,bSearchable:!1},{mData:"CurrencyCode",bVisible:!1,bSearchable:!1},{mData:"OrderStatus",bVisible:!1,bSearchable:!1},{mData:"UpgradeShipSource",bVisible:!1,bSearchable:!1},{mData:"WaivedShipFlag",bVisible:!1,bSearchable:!1},{mData:"StatusToolTip",bVisible:!1,bSearchable:!1},{mData:"OrderStatusDisplay",iDataSort:8,bSearchable:!1},{mData:"ShipmentNumber",bVisible:!1,bSearchable:!1},{mData:"ShipToCountry",bVisible:!1,bSearchable:!1},{mData:"PaymentGuid",bVisible:!1,bSearchable:!1},{mData:"PaymentMethodId",bVisible:!1,bSearchable:!1},{mData:"ActionItem",bVisible:!1,bSearchable:!1},{mData:"InvoiceNumberDisplay",bSortable:!1,bSearchable:!1,mRender:multiRowCellRender,sClass:"border-right-0"},{mData:"InvoiceTotalDisplay",bSortable:!1,bSearchable:!1,mRender:multiRowCellRender,sClass:"border-right-0 border-left-0"},{mData:"InvoiceDateDisplay",bSortable:!1,bSearchable:!1,mRender:multiRowCellRender,sClass:"border-right-0 border-left-0"},{mData:"TrackingNumbersDisplay",bSortable:!1,bSearchable:!1,mRender:multiRowCellRender,sClass:"border-right-0 border-left-0"},{mData:"Requests",bVisible:!0,bSortable:!1,bSearchable:!1,mRender:multiRowCellRender,sClass:"border-left-0"}],fnHeaderCallback:function(e,t){t.length>0&&(typeof addStatusColumnTooltip=="function"?addStatusColumnTooltip(t[0].StatusToolTip):($("#divStatusToolTip").remove(),t.length>0&&t[0].StatusToolTip&&t[0].StatusToolTip.length>0&&$('<div id="divStatusToolTip" class="hidden">'+t[0].StatusToolTip+" </div>").appendTo("body")))},fnDrawCallback:function(){if($(".divStatus .status-bar").length>0||$(".divStatus .progress-bar").length>0||$("img.red-dot").length>0){if(typeof addStatusColumnTooltip!="function"){var t=$("img.status-bar:first").length+$("img.red-dot:first").length,n="ShowStatusToolTip('"+t+"');",s="HideStatusToolTip();";$("img.status-help-icon").length==0&&$('<img src="/Images/icon_tooltip.png" width="14" height="14" class="status-help-icon" onmouseover="'+n+'" onmouseout="'+s+'" />').appendTo(".dataTable th:nth(5) .DataTables_sort_wrapper")}}else $("#status-column-tooltip").remove(),$("img.status-help-icon").remove();typeof addActionColumnTooltip=="function"?addActionColumnTooltip():$("img.actionsStatus-help-icon").length==0&&$('<img id="actionsStatus" src="/Images/icon_tooltip.png" width="14" height="14" class="actionsStatus-help-icon" onmouseover=ShowActionsStatusToolTip() onmouseout=HideActionsStatusToolTip() />').appendTo(".dataTable th:nth(10) .DataTables_sort_wrapper"),typeof OrderStatusLink!="undefined"&&OrderStatusLink.setupStatusLink()},oLanguage:{sProcessing:s.useNewCode?'<div class="m_loader non-modal p-absolute grid-loader" style="display:block" ><div class="processing-img" role="dialog" tabindex="-1" aria-label="'+dataTableResources.LoadingString+'" style="top: 120px;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i></div></div>':'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error text-center text-danger my-4 d-block">'+dataTableResources.lblOrderHistoryNoRecord3+"</span>",sZeroRecords:'<span class="error text-center text-danger my-4 d-block">'+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(o,a,c,l){ShouldDisplayManagePermissionsModal()?DisplayManagePermissionsModal():(a.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()}),s&&s.useNewCode&&typeof DataLayerUtils!="undefined"&&DataLayerUtils.logSearchGa4Event({inputSelector:"#tblOrders_filter input",event:"order_history_orders_search_orders_searched"}),$.ajax({dataType:"json",type:"GET",cache:!1,timeout:5e4,url:"/api/OrderHistory/AnyOrderswithOrganization",error:function(){$(".dataTables_processing").css("visibility","hidden"),n(e,t)},success:function(s){s.ShowManagePermissions&&!s.ShowData?r(e,t):s.ShowData?l.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:5e4,url:o,data:a,success:function(e){i||(i=AddLinks()),c(e)},error:function(){$(".dataTables_processing").css("visibility","hidden"),n(e,t)}}):n(e,t)}}))}}).fnSetFilteringDelay(1e3);$("#tblOrders_length select").bootstrapDropdown({minWidth:"100px"}),$("select[id$=ddlOrderDate]").on("change",function(){o.fnDraw()}),$("select[id$=ddlBuyer]").on("change",function(){o.fnDraw()}),$("select[id$=ddlOrderStatus]").on("change",function(){o.fnDraw()}),$("div[id$=divOrderStatusFilter]").show(),AddHintText(dataTableResources.OrderPoNumber,"tblOrders"),typeof setupGrid=="function"&&setupGrid(),a=new URLSearchParams(window.location.search),a.get("filter").indexOf("returnable")!==-1&&$("select[id$=ddlOrderStatus]").val("-5").change()}function CreateOpenLinesDataTable(){if($("table#tblOpenOrders").length==0)return;var o=!1,e=!1,t=noOrdersOrTimeout,n="order_history_orders_no_info",s=$("table#tblOpenOrders").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/OpenOrders?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[1,"desc"]],oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:"visible",fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,dataTableResources.OpenOrders.replace(" ",""))}})}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"DateCreated",bVisible:!1,bSearchable:!1},{mData:"SalesOrderDateDisplay",iDataSort:0,bSearchable:!1,sWidth:"10%"},{mData:"SalesOrderNumber",bVisible:!1,sWidth:"5%"},{mData:"WebOrderNumber",bVisible:!1,sWidth:"5%"},{mData:"SalesOrderNumberDisplay",iDataSort:1,bSearchable:!1},{mData:"WebOrderNumberDisplay",iDataSort:2,bSearchable:!1},{mData:"PoNumber",iDataSort:3},{mData:"BuyerName",iDataSort:4,bSearchable:!1,sWidth:"10%",mRender:adminIcon},{mData:"OpenLines",iDataSort:5,bSearchable:!1,sWidth:"5%"},{mData:"OpenTotalDisplay",iDataSort:6,bSearchable:!1,sWidth:"5%"},{mData:"CurrencyCode",iDataSort:7,bSearchable:!1,sWidth:"5%"},{mData:"OrderStatus",bVisible:!1,bSearchable:!1,sWidth:"10%"},{mData:"UpgradeShipSource",bVisible:!1,bSearchable:!1},{mData:"WaivedShipFlag",bVisible:!1,bSearchable:!1},{mData:"StatusToolTip",bVisible:!1,bSearchable:!1},{mData:"OrderStatusDisplay",iDataSort:8,bSearchable:!1,sWidth:"15%"},{mData:"ShipmentNumber",bVisible:!1,bSearchable:!1},{mData:"ShipToCountry",bVisible:!1,bSearchable:!1},{mData:"PaymentGuid",bVisible:!1,bSearchable:!1},{mData:"PaymentMethodId",bVisible:!1,bSearchable:!1},{mData:"ActionItem",bSearchable:!1,bSortable:!1,sWidth:"15%"},{mData:"OpenTotal",bSearchable:!1,bVisible:!1}],fnHeaderCallback:function(e,t){$("#divStatusToolTip").remove(),t.length>0&&t[0].StatusToolTip&&t[0].StatusToolTip.length>0&&$('<div id="divStatusToolTip" class="hidden">'+t[0].StatusToolTip+" </div>").appendTo("body")},fnDrawCallback:function(){if($("img.status-bar").length>0||$("img.red-dot").length>0){var t=$("img.status-bar:first").length+$("img.red-dot:first").length,n="ShowStatusToolTip('"+t+"');",s="HideStatusToolTip();";$("img.status-help-icon").length==0&&$('<img src="/Images/icon_tooltip.png" width="14" height="14" class="status-help-icon" onmouseover="'+n+'" onmouseout="'+s+'" />').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(s,i,a,r){ShouldDisplayManagePermissionsModal()?DisplayManagePermissionsModal():(i.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()}),$.ajax({dataType:"json",type:"GET",cache:!1,timeout:3e4,url:"/api/OrderHistory/AnyOpenOrders",error:function(){$(".dataTables_processing").css("visibility","hidden"),t(e,n)},success:function(c){c?r.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:3e4,url:s,data:i,success:function(e){o||(o=AddLinks()),a(e)},error:function(){$(".dataTables_processing").css("visibility","hidden"),t(e,n)}}):t(e,n)}}))}}).fnSetFilteringDelay(1e3);$("select[id$=ddlOrderDate]").on("change",function(){s.fnDraw()}),$("select[id$=ddlBuyer]").on("change",function(){s.fnDraw()}),$("select[id$=ddlOrderStatus]").on("change",function(){s.fnDraw()}),$("div[id$=divOrderStatusFilter]").show(),AddHintText(dataTableResources.OrderPoNumber,"tblOpenOrders")}function CreateInvoiceDataTable(){if($("table#tblInvoices").length==0)return;var s=showManagePermissions,e=typeof dataTablesOverrides!="undefined"?dataTablesOverrides:{},t=typeof dataTablesOverrides!="undefined"&&e.useNewCode,o=noOrdersOrTimeout,n=$("table#tblInvoices").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Invoices?currencyCulture="+encodeURIComponent(currencyCulture)+"&cultureCode="+encodeURIComponent(cultureCode),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[1,"desc"]],oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:"visible",fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,dataTableResources.lblInvoices.replace(" ",""))}})}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"InvoiceDate",bVisible:!1,bSearchable:!1},{mData:"InvoiceDateDisplay",iDataSort:0,bSearchable:!1,sWidth:"10%"},{mData:"InvoiceNumber",bVisible:!1},{mData:"InvoiceNumberDisplay",iDataSort:1,bSearchable:!1},{mData:"InvoiceTotal",bVisible:!1,bSearchable:!1},{mData:"InvoiceTotalDisplay",iDataSort:2,bSearchable:!1},{mData:"OrderDate",bVisible:!1,bSearchable:!1},{mData:"SalesOrderDateDisplay",iDataSort:4,bSearchable:!1,sWidth:"10%"},{mData:"SalesOrderNumber",bVisible:!1},{mData:"WebOrderNumber",bVisible:!1},{mData:"SalesOrderNumberDisplay",iDataSort:5,bSearchable:!1},{mData:"WebOrderNumberDisplay",iDataSort:6,bSearchable:!1},{mData:"CurrencyCode",iDataSort:7},{mData:"PoNumber",iDataSort:8,sWidth:"10%"},{mData:"BuyerName",iDataSort:9,bSearchable:!1,sWidth:"15%",mRender:adminIcon},{mData:"InvoiceTypeDisplay",iDataSort:20,bSearchable:!1},{mData:"ShipToCountry",bVisible:!1,bSearchable:!1},{mData:"SoftwareParts",bVisible:!1,bSearchable:!1},{mData:"EmailAddress",bVisible:!1,bSearchable:!1},{mData:"ShippingMethodUvid",bVisible:!1,bSearchable:!1}],oLanguage:{sProcessing:e.useNewCode?'<div class="m_loader non-modal p-absolute grid-loader" style="display:block" ><div class="processing-img" role="dialog" tabindex="-1" aria-label="'+dataTableResources.LoadingString+'" style="top: 120px;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i></div></div>':'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error text-center text-danger my-4 d-block">'+dataTableResources.lblNoResultsFilter+"</span>",sZeroRecords:'<span class="error text-center text-danger my-4 d-block">'+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(n,i,a,r){if(ShouldDisplayManagePermissionsModal())DisplayManagePermissionsModal();else{var c=e.useNewCode?"/account/invoices/any":"/api/OrderHistory/AnyInvoiceswithOrganization";i.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()}),typeof DataLayerUtils!="undefined"&&DataLayerUtils.logSearchGa4Event({inputSelector:"#tblInvoices_filter input",event:"order_history_invoices_search_orders_searched"}),$.ajax({dataType:"json",type:"GET",cache:!1,timeout:1e5,url:c,error:function(){$(".dataTables_processing").css("visibility","hidden")},success:function(c){if(e.useNewCode&&!c.HasOrders&&!c.ShowData){var l="order_history_invoices_no_info";c.ShowManagePermissions?s(t,l):o(t,l)}else!e.useNewCode&&c.ShowManagePermissions&&!c.ShowData?s(t,"order_history_invoice_no_info"):r.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:1e5,url:n,data:i,success:function(e){a(e)},error:function(){$(".dataTables_processing").css("visibility","hidden")}})}})}}}).fnSetFilteringDelay(1e3);e.useNewCode||n.fnSetColumnVis(15,!1,!1),$("select[id$=ddlOrderDate]").on("change",function(){n.fnDraw()}),$("select[id$=ddlBuyer]").on("change",function(){n.fnDraw()}),AddHintText(dataTableResources.InvoiceOrderPoNumber,"tblInvoices"),typeof setupGrid=="function"&&setupGrid()}function CreateOrderSearchDataTable(){if($("table#tblOrderSearch").length==0)return;var i=!1,e=typeof dataTablesOverrides!="undefined"?dataTablesOverrides:{},t=typeof dataTablesOverrides!="undefined"&&e.useNewCode,o=noOrdersOrTimeout,a=showManagePermissions,n="order_history_search_paging_no_info",s=$("table#tblOrderSearch").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,aaSorting:[[15,"desc"]],sAjaxSource:"/api/OrderHistory/Search?currencyCulture="+encodeURIComponent(currencyCulture)+"&cultureCode="+encodeURIComponent(cultureCode),sDom:'<"H"frli>t<"F"Tp>',fnHeaderCallback:function(t,n){n.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"),e.useNewCode||$("a#lnkSelectAll").on("click",function(){SelectAllCheckboxes("tblOrderSearch")})},oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:"visible",fnClick:function(e,t){s.fnSetColumnVis(0,!1,!1);var o=this.fnGetTableData(t);s.fnSetColumnVis(0,!0,!1),$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,o,dataTableResources.btnSearch.replace(" ",""))}})}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mDataProp:null,sDefaultContent:"",bSortable:!1,bSearchable:!1,sWidth:"5%",sClass:e.useNewCode?"text-center":"center"},{mData:"MouserPartNumber",bVisible:!1},{mData:"MouserPartNumberDisplay",iDataSort:0,bSearchable:!1},{mData:"CustomerPartNumber",iDataSort:1},{mData:"MFRPartNumber",iDataSort:2},{mData:"Manufacturer",iDataSort:3,sWidth:"10%"},{mData:"PartDescription",iDataSort:4,sWidth:"10%"},{mData:"Quantity",iDataSort:5},{mData:"UnitPrice",bVisible:!1,bSearchable:!1},{mData:"UnitPriceDisplay",iDataSort:6,bSearchable:!1},{mData:"PONumber",iDataSort:7},{mData:"BuyerName",iDataSort:8,bSearchable:!1,mRender:adminIcon},{mData:"UVSalesOrder_ID",bVisible:!1},{mData:"SalesOrderNumberDisplay",iDataSort:9,bSearchable:!1},{mData:"OrderDate",bVisible:!1},{mData:"SalesOrderDateDisplay",iDataSort:10},{mData:"UVInvoice_ID",bVisible:!1},{mData:"InvoiceNumberDisplay",iDataSort:11,bSearchable:!1},{mData:"InvoiceDate",bVisible:!1,bSearchable:!1},{mData:"InvoiceDateDisplay",iDataSort:12,bSearchable:!1},{mData:"ExtPrice",bVisible:!1},{mData:"CurrencyCode",bVisible:!1},{mData:"ShipToCountry",bVisible:!1,bSearchable:!1}],aoColumnDefs:[{fnRender:function(e){return'<input type="checkbox" class="os-line-select" aria-label="Checkbox Part Number '+e.aData.MouserPartNumber+" Quantity "+e.aData.Quantity+'" data-partnumber="'+e.aData.MouserPartNumber+'" data-quantity="'+e.aData.Quantity+'">'},aTargets:[0]}],oLanguage:{sProcessing:e.useNewCode?'<div class="m_loader non-modal p-absolute grid-loader" style="display:block" ><div class="processing-img" role="dialog" tabindex="-1" aria-label="'+dataTableResources.LoadingString+'" style="top: 120px;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i></div></div>':'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error text-center text-danger my-4 d-block">'+dataTableResources.lblNoResultsFilter+"</span>",sZeroRecords:'<span class="error text-center text-danger my-4 d-block">'+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(e,s,r,c){ShouldDisplayManagePermissionsModal()?DisplayManagePermissionsModal():(s.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()}),typeof DataLayerUtils!="undefined"&&DataLayerUtils.logSearchGa4Event({inputSelector:"#tblOrderSearch_filter input",event:"order_history_search_search_orders_searched"}),$.ajax({dataType:"json",type:"GET",cache:!1,timeout:3e4,url:"/api/OrderHistory/AnyOrderswithOrganization",error:function(){$(".dataTables_processing").css("visibility","hidden"),o(t,n)},success:function(l){l.ShowManagePermissions&&!l.ShowData&&t?a(!0,n):l.ShowData?c.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:3e4,url:e,data:s,success:function(e){i||(i=AddLinks()),r(e),typeof OrderSearchSelectLine!="undefined"&&OrderSearchSelectLine.setup()},error:function(){$(".dataTables_processing").css("visibility","hidden"),o(t,n)}}):o(t,n)}}))}}).fnSetFilteringDelay(1e3);$("#tblOrderSearch_length select").bootstrapDropdown({minWidth:"100px"}),$("select[id$=ddlOrderDate]").on("change",function(){s.fnDraw()}),$("select[id$=ddlBuyer]").on("change",function(){s.fnDraw()}),$("div[id$=divOrderStatusFilter]").show(),AddHintText(dataTableResources.SearchHintText,"tblOrderSearch"),typeof setupGrid=="function"&&setupGrid(),typeof DataLayerUtils!="undefined"&&typeof PartSearch=="undefined"&&DataLayerUtils.setupDataTablePagingEvent({containerSelector:"#divOrderHistoryGrid",tableLength:"order_history_search_display_rows_dropdown_clicked",footerButtons:["order_history_search_view_export_to_excel_clicked","order_history_search_view_print_view_opened"]}),$("#divOrderHistoryGrid").on("click","a.sales-order-number-link",function(){typeof dataLayer!="undefined"&&dataLayer.push({event:"order_history_search_sales_order_clicked"})}),$("#divOrderHistoryGrid").on("click","a.invoice-number-link",function(){typeof dataLayer!="undefined"&&dataLayer.push({event:"order_history_search_view_invoice_clicked"})}),e.useNewCode||$(document).on("keydown",".DTTT_Print",function(e){e.keyCode==27&&typeof dataLayer!="undefined"&&dataLayer.push({event:"order_history_search_view_print_view_escaped"})})}function CreateSavedCartsDataTable(){if($("table#tblSavedCarts").length==0)return;var e,t=$("table#tblSavedCarts").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/SavedCarts?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[16,"desc"]],fnHeaderCallback:function(e,t){t.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").on("click",function(){SelectAllCheckboxes("tblSavedCarts")})},fnDrawCallback:function(e){$("div.floatright,hidden").removeClass("hidden"),e.aoData.length==0?$("div.divOrderHistoryContainer a.cartActive,a.cartMerge,a.cartDelete").addClass("hide"):e.aoData.length==1?($("div.divOrderHistoryContainer a.cartMerge").addClass("hide"),e.aoData[0]._aData.ActiveCart?$("div.divOrderHistoryContainer a.cartActive").addClass("hide"):$("div.divOrderHistoryContainer a.cartActive").removeClass("hide"),$("div.divOrderHistoryContainer a.cartDelete").removeClass("hide")):$("div.divOrderHistoryContainer a.cartActive,a.cartMerge,a.cartDelete").removeClass("hide")},oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:"visible",fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,"SharedCart")}})}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"EditLink",iDataSort:0},{mData:"AccessId",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"AccessIdDisplay",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"DateCreated",bVisible:!1,bSearchable:!1},{mData:"DateCreatedDisplay",iDataSort:3,bSearchable:!1},{mData:"LastUpdated",bVisible:!1,bSearchable:!1},{mData:"LastUpdatedDisplay",iDataSort:16,bSearchable:!1},{mData:"OrderStatus",iDataSort:5,bSearchable:!1},{mData:"DeleteLink",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"ProjectGuid",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"EditLink",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"SharedLink",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"ProjectLineCount",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"DisableDropdown",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"Archived",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"IsSavedOrSharedCart",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"CartGuid",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"ProjectLineCount",iDataSort:10,bSearchable:!1},{mData:"ActiveCart",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"HasScheduleReleases",bVisible:!1,bSearchable:!1,bSortable:!1},{mDataProp:null,sDefaultContent:"",bSortable:!1,bSearchable:!1,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(e){return'<input class="chk-cart" type="checkbox" data-projectGuid="'+e.aData.AccessId+'" data-cartGuid="'+e.aData.CartGuid+'" data-activeCart="'+e.aData.ActiveCart+'">'},aTargets:[20]}],fnServerData:function(e,t,n,s){typeof DataLayerUtils!="undefined"&&DataLayerUtils.logSearchGa4Event({inputSelector:"#tblSavedCarts_filter input",event:"saved_shared_carts_view_search_carts_searched"}),t.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()}),s.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:3e4,url:e,data:t,success:n,error:function(){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1e3);$("select[id$=ddlOrderDate]").on("change",function(){t.fnDraw()}),AddHintText(dataTableResources.lblCartNameHeader,"tblSavedCarts"),e=GetSavedCartHelpModalValue(),(!e||e==="0")&&(DisplayCartHelpModal(!0),HideSavedCartsHelpModal())}function GetSavedCartHelpModalValue(){var e=getPreferencesCookie();return e.SCH}function CreateSavedCart(e,t){$.ajax({url:"/api/OrderHistory/CreateSavedCart?cartGuid="+encodeURIComponent(e)+"&cartName="+encodeURIComponent(t),cache:!1,type:"POST",timeout:15e3,contentType:"application/json",success:function(e){window.location.href=e},error:function(){alert($("span[id$=litError]").html().trim())}})}function MakeCartActive(){if($("div.divOrderHistoryContainer a.cartActive").hasClass("disabled"))return;var t,e=$(":checkbox:checked");if(!AreAnyChecked()){AddOrderHistoryGa("Error Message Pop-up","Make Active Error (None Selected)"),DisplayInfoModal(dataTableResources.SelectCartToMakeActive,dataTableResources.MakeCartActive,MakeCartActiveConfirmNoCartCanceled),typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_make_active_modal_opened_no_cart"});return}if($(":checkbox:checked").length>1){AddOrderHistoryGa("Error Message Pop-up","Make Active Error (Multiple Selected)"),DisplayInfoModal(dataTableResources.OneCartActive,dataTableResources.MakeCartActive,MakeCartActiveConfirmManySelectedCanceled),typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_make_active_modal_opened_too_many"});return}if(e.data("activecart")){AddOrderHistoryGa("Error Message Pop-up","Make Active Error (Active Cart Active)"),e.prop("checked",!1),typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_make_active_modal_opened_already_active"}),t=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+dataTableResources.SelectedCartIsActive+"</p></div>"),t.dialog({title:dataTableResources.MakeCartActive,resizable:!1,modal:!0,width:440,height:200,maxHeight:550,close:function(e){MakeCartActiveConfirmAlreadActiveCanceled(e),$(this).dialog("destroy")},buttons:[{id:"submitHdr",text:dataTableResources.lblViewCart,class:"ui-button",click:function(e){MakeCartActiveConfirmAlreadActiveCanceled(e),$(this).dialog("destroy"),window.location.href="/Cart"}}]});return}typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_make_active_modal_opened"}),DisplayConfirmModal(dataTableResources.ConfirmActiveCart,dataTableResources.MakeCartActive,dataTableResources.MakeActive,ActivateCart,MakeCartActiveConfirmCanceled)}function MakeCartActiveConfirmCanceled(e){if(MakeCartActiveCancelGa(),typeof dataLayer=="undefined")return;$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_make_active_modal_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_make_active_modal_closed_cancel"})}function MakeCartActiveConfirmAlreadActiveCanceled(e){if(typeof dataLayer=="undefined")return;$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_make_active_modal_already_active_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_make_active_modal_already_active_view_cart"})}function MakeCartActiveConfirmNoCartCanceled(e){if(typeof dataLayer=="undefined")return;$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_make_active_modal_no_cart_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_make_active_modal_no_cart_closed_button"})}function MakeCartActiveConfirmManySelectedCanceled(e){if(typeof dataLayer=="undefined")return;$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_make_active_modal_too_many_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_make_active_modal_too_many_closed_button"})}function MakeCartActiveCancelGa(){AddOrderHistoryGa("Make Cart Active Button","Cancel Make Active")}function DisplayCartHelpModal(e){var t=$('<div class="sc-help-modal"><p>'+dataTableResources.SavedCartsHelpContent+"</p></div>");t.dialog({title:dataTableResources.SavedSharedCartHelp,resizable:!1,modal:!0,width:600,height:455,maxHeight:550,beforeClose:function(){var t=$("div.helpSection-helpBox").scrollTop()>600?1:0;e?AddOrderHistoryGa("Active Cart Help","Welcome Help",t):AddOrderHistoryGa("Active Cart Help","Button Help",t)},open:function(){typeof dataLayer!="undefined"&&(e?dataLayer.push({event:"saved_shared_carts_view_help_modal_opened_auto"}):dataLayer.push({event:"saved_shared_carts_view_help_modal_opened_click"}),$(".helpSection-imageWrapper + a").on("click",function(){dataLayer.push({event:"saved_shared_carts_view_help_modal_back_to_top"})}))},close:function(){typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_help_modal_closed_x"}),$(this).dialog("destroy")}})}function HideSavedCartsHelpModal(){if(GetSavedCartHelpModalValue()==="1")return;$.ajax({type:"POST",async:!1,url:"/api/Preferences/HideSavedCartsHelpModal?sch=1",timeout:3e3})}function DisplayConfirmModal(e,t,n,s,o){var i=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+e+"</p></div>");i.dialog({title:t,resizable:!1,modal:!0,width:440,height:200,maxHeight:550,close:function(e){$(this).dialog("destroy"),o(e)},buttons:[{id:"btnCancel",text:dataTableResources.btnCancel,click:function(e){$(this).dialog("destroy"),o(e)}},{id:"btnConfirm",text:n,class:"ui-button",click:function(e){$(this).dialog("destroy"),s(e)}}]})}function ActivateCart(){var t="",e=$(":checkbox:checked");e.data("projectguid").toString().length>0&&e.data("projectguid")!="-"?t=e.data("projectguid"):e.data("cartguid").toString().length>0&&(t=e.data("cartguid")),typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_make_active_modal_activated"}),$.ajax({url:"/api/OrderHistory/MakeCartActive?guid="+encodeURIComponent(t),cache:!1,type:"POST",timeout:3e4,contentType:"application/json",success:function(t){var n=$("table#tblSavedCarts").dataTable().fnGetData(e.parents("tr")[0]).DateCreated,s=n.split("T");AddOrderHistoryGa("Make Cart Active Button","Make Active",Daydiff(parseDate(s[0]),GetCurrentDate())),typeof dataLayer!="undefined"&&dataLayer.push(t),window.location.href="/Cart"},error:function(){alert($("span[id$=litError]").html().trim())}})}function AddOrderHistoryGa(e,t,n){GaEvent("Order History Page",e,t,n)}function parseDate(e){var t=e.split("-");return new Date(t[0],t[1]-1,t[2])}function Daydiff(e,t){return(t-e)/(1e3*60*60*24)}function GetCurrentDate(){var e=new Date,n=e.getFullYear(),s=e.getDate(),o=n+"-"+("0"+(e.getMonth()+1)).slice(-2)+"-"+("0"+s).slice(-2),t=new String(o).split("-");return new Date(t[0],t[1]-1,t[2])}function DeleteCartsConfirm(){if($("div.divOrderHistoryContainer a.cartDelete").hasClass("disabled"))return;if(!AreAnyChecked()){AddOrderHistoryGa("Error Message Pop-up","Delete Error (None Selected)"),typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_delete_modal_opened_no_cart"}),DisplayInfoModal(dataTableResources.SelectCartToDelete,dataTableResources.btnDeleteCart,function(e){DeleteCartsConfirmNoCartCanceled(e)});return}var n="",s=dataTableResources.btnDeleteCart,e=$(":checkbox:checked"),t="";e.each(function(){$(this).data("activecart")&&(t=!0)}),function(){if(typeof dataLayer=="undefined")return;e.length>1?dataLayer.push({event:"saved_shared_carts_view_delete_modal_multiple_opened"}):t?dataLayer.push({event:"saved_shared_carts_view_delete_modal_active_opened"}):dataLayer.push({event:"saved_shared_carts_view_delete_modal_pending_opened"})}(),t?n=dataTableResources.WarningCartLost:e.length>1?(n=dataTableResources.ConfirmDeleteCarts,s=dataTableResources.DeleteCarts):n=dataTableResources.ConfirmDeleteCart,DisplayConfirmModal(n,dataTableResources.btnDeleteCart,s,function(){onDeleteCartsConfirmConfirmed(t,e.length)},function(n){onDeleteCartsConfirmCanceled(n,t,e.length)})}function DeleteCartsConfirmNoCartCanceled(e){if(typeof dataLayer=="undefined")return;$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_delete_modal_no_cart_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_delete_modal_no_cart_closed_button"})}function onDeleteCartsConfirmConfirmed(e,t){if(DeleteCarts(),typeof dataLayer=="undefined")return;t>1?dataLayer.push({event:"saved_shared_carts_view_delete_modal_multiple_deleted"}):e?dataLayer.push({event:"saved_shared_carts_view_delete_modal_active_deleted"}):dataLayer.push({event:"saved_shared_carts_view_delete_modal_pending_deleted"})}function onDeleteCartsConfirmCanceled(e,t,n){if(AddOrderHistoryGa("Delete Cart Button","Cancel"),typeof dataLayer=="undefined")return;n>1?$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_delete_modal_multiple_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_delete_modal_multiple_closed_cancel"}):t?$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_delete_modal_active_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_delete_modal_active_closed_cancel"}):$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_delete_modal_pending_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_delete_modal_pending_closed_cancel"})}function DeleteCartsCancelGa(){AddOrderHistoryGa("Delete Cart Button","Cancel")}function GetCartAndProjectList(){var s=$(":checkbox:checked"),t=[],n=[],e={};return e.HasActiveCart=!1,s.each(function(){$(this).data("activecart")&&(e.HasActiveCart=!0),$(this).data("projectguid").toString().length>0&&$(this).data("projectguid")!="-"?n.push($(this).data("projectguid")):$(this).data("cartguid").toString().length>0&&t.push($(this).data("cartguid"))}),e.ProjectList=n,e.CartList=t,e}function DeleteCarts(){var e=GetCartAndProjectList();$.ajax({url:"/api/OrderHistory/DeleteCarts",cache:!1,type:"POST",timeout:3e4,contentType:"application/json",data:JSON.stringify(e),success:function(){var t=e.ProjectList.length+e.CartList.length>1?"Multiple Delete":"Single Delete";AddOrderHistoryGa("Delete Cart Button",t),$("table#tblSavedCarts").dataTable().fnReloadAjax(),e.HasActiveCart&&(MiniCart.SetStringNMsgForMiniCart(0,0),MiniCart.CreateMiniCart(!0),MiniCart.TotalDisplayRecords=0)},error:function(){alert($("span[id$=litError]").html().trim())}})}function MergeCartsConfirm(){if($("div.divOrderHistoryContainer a.cartMerge").hasClass("hide"))return;var e=$(":checkbox:checked").length;if(!AreAnyChecked()||e<2){AddOrderHistoryGa("Error Message Pop-up","Merge Carts Error (None/One Selected)"),typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_merge_carts_modal_opened_no_cart"}),DisplayInfoModal(dataTableResources.TwoMergeCarts,dataTableResources.MergeCarts,function(t){onMergeCartsConfirmCanceled(t,e)});return}typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_merge_carts_modal_opened"}),DisplayConfirmModal(dataTableResources.ConfirmMergeCarts,dataTableResources.MergeCarts,dataTableResources.MergeCarts,MergeCarts,function(t){onMergeCartsConfirmCanceled(t,e)})}function MergeCartsCancelGa(){AddOrderHistoryGa("Merge Carts Button","Cancel Merge Carts")}function MergeCarts(){typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_shared_carts_view_merge_carts_modal_merged"});var t=setTimeout(function(){$("a#lnkloader").trigger("click")},1500),e=GetCartAndProjectList();$.ajax({url:"/api/OrderHistory/MergeCarts?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),cache:!1,type:"POST",timeout:12e4,contentType:"application/json",data:JSON.stringify(e),success:function(){AddOrderHistoryGa("Merge Carts Button","Merge Carts",e.ProjectList.length+e.CartList.length),window.clearTimeout(t),$("table#tblSavedCarts").dataTable().fnReloadAjax()},error:function(){alert($("span[id$=litError]").html().trim())}})}function onMergeCartsConfirmCanceled(e,t){if(typeof dataLayer=="undefined")return;t<2?$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_merge_carts_modal_no_cart_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_merge_carts_modal_no_cart_closed_cancel"}):(MergeCartsCancelGa(),$(e.currentTarget).hasClass("ui-dialog-titlebar-close")?dataLayer.push({event:"saved_shared_carts_view_merge_carts_modal_closed_x"}):dataLayer.push({event:"saved_shared_carts_view_merge_carts_modal_closed_cancel"}))}function CreateProjectsDataTable(){if($("table#tblProjects").length==0)return;var e=typeof dataTablesOverrides!="undefined"?dataTablesOverrides:{},t=$("table#tblProjects").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Projects?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[3,"desc"]],oTableTools:{aButtons:e.useNewCode?[]:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:"visible",fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,dataTableResources.lbProject.replace(" ",""))}})}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"EditLink",iDataSort:0},{mData:"ProjectLineCount",iDataSort:10,bSearchable:!1},{mData:"DateCreated",bVisible:!1,bSearchable:!1},{mData:"DateCreatedDisplay",iDataSort:3,bSearchable:!1},{mData:"AccessId",bSortable:!1},{mData:"ArchiveLink",bSearchable:!1,bSortable:!1},e.useNewCode?{mData:"Actions",bSearchable:!1,bSortable:!1,sWidth:"10%"}:{mData:"SharedLink",bSearchable:!1,bSortable:!1,sWidth:"5%"},e.useNewCode?{mData:"DeleteLink",bVisible:!1,bSearchable:!1,bSortable:!1,sWidth:"5%"}:{mData:"DeleteLink",bSearchable:!1,bSortable:!1,sWidth:"5%"},{mData:"OrderStatus",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"ProjectGuid",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"DisableDropdown",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"Archived",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"IsSavedOrSharedCart",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"CartGuid",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"ActiveCart",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"LastUpdated",bVisible:!1,bSearchable:!1,bSortable:!1},{mData:"HasScheduleReleases",bVisible:!1,bSearchable:!1,bSortable:!1}],oLanguage:{sProcessing:e.useNewCode?'<div class="m_loader non-modal p-absolute grid-loader" style="display:block" ><div class="processing-img" role="dialog" tabindex="-1" aria-label="'+dataTableResources.LoadingString+'" style="top: 450px;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i></div></div>':'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sEmptyTable:'<span class="error text-center text-danger my-4 d-block">'+dataTableResources.lblProjects+"</span>",sZeroRecords:'<span class="error text-center text-danger my-4 d-block">'+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(e){e.aoData.length==0||e.aoData[0]._aData.DisableDropdown?($("select[id$=ddlProjectArchive]").val("-1"),$("select[id$=ddlProjectArchive]").prop("disabled",!0)):$("select[id$=ddlProjectArchive]").prop("disabled",!1),$("a.pm-delete").on("click",function(){dataLayer.push({event:"proj_view_delete_proj_modal_open"});var e=$(this),n=e.data("guid"),s=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+dataTableResources.ConfirmDelete.format(dataTableResources.lblProject)+"</p></div>");s.dialog({title:dataTableResources.btnDeleteProject,resizable:!1,modal:!0,width:440,height:200,maxHeight:550,close:function(){dataLayer.push({event:"proj_view_delete_proj_modal_close_x"}),$(this).dialog("destroy")},buttons:[{id:"btnCancel",text:dataTableResources.btnCancel,click:function(){dataLayer.push({event:"proj_view_delete_proj_modal_close_cancel"}),$(this).dialog("destroy")}},{id:"btnConfirm",text:dataTableResources.btnDeleteProject,class:"ui-button",click:function(){dataLayer.push({event:"proj_view_delete_proj_modal_deleted"}),DeleteProject($(this),t,e,n)}}]})}),$("a.pm-share").on("click",function(){$.ajax({url:"/api/OrderHistory/ShareProject?projectGuid="+$(this).data("guid"),cache:!1,timeout:2e4,type:"POST",success:function(e){window.location.href=e},error:function(){}}),dataLayer.push({event:"proj_view_share_proj_click"})}),$("a.m-btn-primary,a.m-btn-secondary","#tblProjects").on("click",function(){ShowArchiveProjectModal(t,$(this).data("guid"),$(this).data("archive")=="True","Homepage",dataTableResources.ArchiveThisProject,dataTableResources.ActivateThisProject,dataTableResources.ArchiveProject,dataTableResources.btnCancel,dataTableResources.ArchiveProject,dataTableResources.ActivateProject,dataTableResources.lblCommErrorTitle)}),bindCommonGA4ClickEvent("a.data-datalayer-click","proj_view_proj_detail_click")},fnServerData:function(e,t,n,s){typeof DataLayerUtils!="undefined"&&$("#tblProjects_filter input").val()!=""&&DataLayerUtils.logSearchGa4Event({inputSelector:"#tblProjects_filter input",event:"proj_view_search_projects_searched"}),t.push({name:"dateFilter",value:$("select[id$=ddlOrderDate] option:selected").val()},{name:"projectFilter",value:$("select[id$=ddlProjectArchive] option:selected").val()}),s.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:3e4,url:e,data:t,success:n,error:function(){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1e3);$("select[id$=ddlOrderDate]").on("change",function(){t.fnDraw()}),$("select[id$=ddlProjectArchive]").on("change",function(){t.fnDraw()}),$("div[id$=divProjectArchiveFilter]").show(),AddHintText(dataTableResources.ProjectNameAccessID,"tblProjects"),$("div#tblProjects_filter").parent().find("input").attr("id","txtSearch"),$("div#tblProjects_filter").parent().find("select").attr("id","ddlPageSize"),bindCommonGA4ClickEvent("#txtSearch","proj_view_search_projects_click"),bindCommonGA4FocusEvent("#ddlPageSize","proj_view_display_rows_dropdown_click"),bindCommonGA4FocusEvent("#ddlProjectArchive","proj_view_view_dropdown_click"),$("input[id$=btnNewProject]").on("click",function(){return!0}),typeof setupGrid=="function"&&setupGrid()}function CreateNewProjectsDataTable(){if($("table#tblNewProjects").length==0)return;GetProjectsDataTable()}function bindCommonGA4ClickEvent(e,t){$(e).on("click",function(){dataLayer.push({event:t})})}function bindCommonGA4FocusEvent(e,t){$(e).on("focus",function(){dataLayer.push({event:t})})}function CreateQuotesDataTable(){if($("table#tblQuotes").length==0)return;var t=showQuotesManagePermissions,e=$("table#tblQuotes").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Quotes?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',fnHeaderCallback:function(e,t){t.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").on("click",function(){SelectAllCheckboxes("tblQuotes")})},fnDrawCallback:function(){e.fnSettings().fnRecordsTotal()<=0&&window.location.href.indexOf("qs")=="-1"?($("span[id$=lblQuotesDetails]").hide(),$("select[id$=ddlOrderDate] option:selected").index()>0||$("select[id$=ddlBuyer] option:selected").index()>0?($("div[id$=divQuoteSearch]").hide(),$("#divSearchGrid").show()):($("div[id$=divQuoteSearch]").show(),$("#divSearchGrid").hide(),typeof dataLayer!="undefined"&&dataLayer.push({event:"quotes_view_no_quotes_shown"}))):($("#divSearchGrid").show(),$("span[id$=lblQuotesDetails]").show(),$("div[id$=divQuoteSearch]").hide())},aaSorting:[[2,"desc"]],oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:"visible",fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,dataTableResources.Quotes.replace(" ",""))}})}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mDataProp:null,sDefaultContent:"",bSortable:!1,bSearchable:!1,sClass:"center"},{mData:"DateCreated",bVisible:!1,bSearchable:!1},{mData:"DateCreatedDisplay",iDataSort:0,bSearchable:!1},{mData:"QuoteNumber",bVisible:!1},{mData:"QuoteNumberDisplay",bSearchable:!1,iDataSort:2},{mData:"ReferenceNumber",iDataSort:4},{mData:"BuyerName",bSearchable:!1,iDataSort:5,mRender:adminIcon},{mData:"ProductCount",bSearchable:!1,iDataSort:6},{mData:"SalesRep",bSearchable:!1,bSortable:!1},{mData:"Status",bSearchable:!1,iDataSort:8}],aoColumnDefs:[{fnRender:function(e){return e.aData.ValidCurrency?'<input type="checkbox" class="chk-quote" data-guid="'+e.aData.Guid+'" data-quotenumber="'+e.aData.QuoteNumber+'">':""},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(e,n,s,o){ShouldDisplayManagePermissionsModal()?DisplayManagePermissionsModal():(n.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()}),$.ajax({dataType:"json",type:"GET",cache:!1,timeout:1e5,url:"/api/OrderHistory/AnyQuoteswithOrganization",error:function(e){$(".dataTables_processing").css("visibility","hidden"),e.responseText&&e.responseText.indexOf("Invalid querystring count")>-1&&(window.location.href="/MyAccount/MouserLogin")},success:function(i){i.ShowManagePermissions?t():o.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:1e5,url:e,data:n,success:s,error:function(e){$(".dataTables_processing").css("visibility","hidden"),e.responseText&&e.responseText.indexOf("Invalid querystring count")>-1&&(window.location.href="/MyAccount/MouserLogin")}})}})),typeof DataLayerUtils!="undefined"&&DataLayerUtils.logSearchGa4Event({inputSelector:"#tblQuotes_filter input",event:"quotes_view_search_quotes_searched"})}}).fnSetFilteringDelay(1e3);$("select[id$=ddlOrderDate]").on("change",function(){e.fnDraw()}),$("select[id$=ddlBuyer]").on("change",function(){e.fnDraw()}),AddHintText(dataTableResources.QuoteSearchText,"tblQuotes")}function CreateQuotesDataTableMVC(){if($("table#tblQuotesMVC").length==0)return;var t=showQuotesManagePermissions,n=typeof dataTablesOverrides!="undefined"?dataTablesOverrides:{},e=$("table#tblQuotesMVC").dataTable({scrollX:!0,bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Quotes?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',fnHeaderCallback:function(e,t){if(t.length>0&&$('input[type="checkbox"]#lnkSelectAll').length==0){var n=$('<input id="lnkSelectAll" type="checkbox" style="height:13px;width:13px" data-testid="selectAll" aria-label="'+Resources.MyMouser.lblSelectAllQuotes+'"/>');$(n).appendTo(".dataTable td:nth(0)"),$("#tblQuotesMVC_filter input").val("")}$('[type = "checkbox"]#lnkSelectAll').prop("checked",!1),$("#buySelectedQuotes").prop("disabled",!0),$("#bottomBuySelectedQuotes").prop("disabled",!0),$("table#tblQuotesMVC tbody").on("change",'input[type="checkbox"]',function(){var e=!0;$('input[type="checkbox"]:checked').length>0&&($('[type = "checkbox"]#lnkSelectAll').prop("checked")!=!0||$('input[type="checkbox"]:checked').length!=1)?($("#buySelectedQuotes").prop("disabled",!1),$("#bottomBuySelectedQuotes").prop("disabled",!1)):($("#buySelectedQuotes").prop("disabled",!0),$("#bottomBuySelectedQuotes").prop("disabled",!0)),$('table#tblQuotesMVC tbody input[type="checkbox"]').each(function(){if(!$(this).prop("checked"))return e=!1,!1}),$('[type = "checkbox"]#lnkSelectAll').prop("checked",e)}),$('input[type="checkbox"]#lnkSelectAll').on("click",function(){$(this).prop("checked")?($("#buySelectedQuotes").prop("disabled",!1),$("#bottomBuySelectedQuotes").prop("disabled",!1)):($("#buySelectedQuotes").prop("disabled",!0),$("#bottomBuySelectedQuotes").prop("disabled",!0)),$("table#tblQuotesMVC tbody [type=checkbox]").each(function(){$(this).prop("checked",$('[type = "checkbox"]#lnkSelectAll').prop("checked"))})})},fnDrawCallback:function(){window.location.href.indexOf("qs")=="-1"?$("#dateDD").show():$("#dateDD").hide(),e.fnSettings().fnRecordsTotal()<=0&&window.location.href.indexOf("qs")=="-1"?$("select[id$=ddlOrderDate] option:selected").index()>0||$("select[id$=ddlBuyer] option:selected").index()>0?($("#QuoteHistoryDataTable").show(),$("#quoteSearchDiv").hide(),$("#quoteActionButtons").show(),$("#btnExcelExport").show(),$("#btnEmail").show(),$("#btnPrint").show()):($("#QuoteHistoryDataTable").hide(),$("#quoteSearchDiv").show(),$("#btnExcelExport").hide(),$("#btnEmail").hide(),$("#btnPrint").hide(),typeof dataLayer!="undefined"&&dataLayer.push({event:"quotes_view_no_quotes_shown"})):($("#QuoteHistoryDataTable").show(),$("#quoteSearchDiv").hide(),$("#quoteActionButtons").show(),$("#btnExcelExport").show(),$("#btnEmail").show(),$("#btnPrint").show())},aaSorting:[[0,"desc"]],aoColumns:[{mDataProp:null,sDefaultContent:"",bSortable:!1,bSearchable:!1,sClass:"center d-print-none"},{mData:"QuoteNumber",bVisible:!1},{mData:"QuoteNumberDisplay",bSearchable:!1,iDataSort:2},{mData:"ProductCount",bSearchable:!1,iDataSort:6},{mData:"DateCreated",bVisible:!1,bSearchable:!1},{mData:"DateCreatedDisplay",iDataSort:0,bSearchable:!1},{mData:"ReferenceNumber",iDataSort:4},{mData:"BuyerName",bSearchable:!1,iDataSort:5,mRender:adminIcon},{mData:"SalesRep",bSearchable:!1,bSortable:!1},{mData:"Status",bSearchable:!1,iDataSort:8}],oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:[2,3,5,8,6,7,9,10],fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,dataTableResources.Quotes.replace(" ",""))}})}}]},aoColumnDefs:[{fnRender:function(e){return e.aData.ValidCurrency?'<input type="checkbox" class="chk-quote" data-guid="'+e.aData.Guid+'" data-quotenumber="'+e.aData.QuoteNumber+'" data-testid="'+e.aData.QuoteNumber+'" aria-label ="'+Resources.MyMouser.lblSelectQuote.replace("{0}",e.aData.QuoteNumber)+'">':""},aTargets:[0]}],oLanguage:{sProcessing:n.useNewCode?'<div class="m_loader non-modal p-absolute grid-loader" style="display:block" ><div class="processing-img" role="dialog" tabindex="-1" aria-label="'+dataTableResources.LoadingString+'" style="top: 120px;"><i class="fa fa-spinner fa-spin fa-2x fa-fw"></i></div></div>':'<img style="border-width:0px;" src="../images/processing_indicator.gif">',sZeroRecords:'<span class="error text-center text-danger my-4 d-block">'+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(e,n,s,o){ShouldDisplayManagePermissionsModal()?DisplayManagePermissionsModal():(n.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()}),$.ajax({dataType:"json",type:"GET",cache:!1,timeout:1e5,url:"/api/OrderHistory/AnyQuoteswithOrganization",error:function(e){$(".dataTables_processing").css("visibility","hidden"),e.responseText&&e.responseText.indexOf("Invalid querystring count")>-1&&(window.location.href="/MyAccount/MouserLogin")},success:function(i){i.ShowManagePermissions?t():o.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:1e5,url:e,data:n,success:s,error:function(e){$(".dataTables_processing").css("visibility","hidden"),e.responseText&&e.responseText.indexOf("Invalid querystring count")>-1&&(window.location.href="/MyAccount/MouserLogin")}})}})),typeof DataLayerUtils!="undefined"&&DataLayerUtils.logSearchGa4Event({inputSelector:"#tblQuotesMVC_filter input",event:"quotes_view_search_quotes_searched"})}}).fnSetFilteringDelay(1e3);$("select[id$=ddlOrderDate]").on("change",function(){e.fnDraw()}),$("select[id$=ddlBuyer]").on("change",function(){e.fnDraw()}),AddHintText(dataTableResources.QuoteSearchText,"tblQuotesMVC"),typeof setupGrid=="function"&&(setupGrid(),SetUpQuotesGrid())}function ExtractData(e,t,n){if(Number(e)==e)return e;var s,o,i,a,r,c,u=e.indexOf("href"),l=e.indexOf("return false"),d=e.indexOf("divStatus"),m=e.indexOf("javascript"),p=e.indexOf("<br />"),h=e.indexOf("span"),f=e.indexOf("fa-shield-check");if(u>0||t==21||t==24)if(t==21||t==24){s=e.split("<br />"),RemoveEmptyArrayItems(s);for(o="",i=0;i<s.length;i++)u>0?o+=s[i].substring(s[i].indexOf(">")+1,s[i].indexOf("</a>")):o+=s[i],s[i].length>0&&o!="-"&&s.length-1>i&&(o+=n);e=o}else e=e.substring(e.indexOf(">")+1,e.indexOf("</a>"));else if(l>0)e=e.substring(l+15,e.length).replace("</a>",""),r=e.indexOf(" "),r>0&&(e=e.replace(e.substring(r,e.length),""));else if(d>0)e=e.substring(d+11,e.length).replace("</div>",""),c=e.indexOf("<img"),c>0&&(e=e.replace(e.substring(c,e.length),""));else if(m>0)e="";else if(p>0){s=e.split("<br />"),RemoveEmptyArrayItems(s),o="";for(a=0;a<s.length;a++)o+=s[a],s[a].length>0&&s.length-1>a&&(o+=n);e=o}else h>0&&(e=e.substring(h+19,e.length).replace("</span>",""));return f>0&&(e=e.replace(/<i[^>]*><\/i>/ig,"")),e=e.replace(/<br\s*\/?>/gi,"")}function RemoveEmptyArrayItems(e){var t=e.indexOf("");t>-1&&e.splice(t,1)}function ReorderSelectedItems(e,t){if(AreAnyChecked()){t&&typeof dataLayer!="undefined"&&dataLayer.push({event:t}),$(".dataTables_processing").css("visibility","visible");var n={};$("table#tblOrderSearch input:checked").each(function(){var t=$(this).data("quantity"),e=$(this).data("partnumber");n[e]?n[e]=n[e]+t:n[e]=t}),$.ajax({url:"/api/OrderHistory/ReorderSelectedItems",cache:!1,type:"POST",timeout:3e4,contentType:"application/json",data:JSON.stringify(n),success:function(e){typeof dataLayer!="undefined"&&dataLayer.push(e),window.location.href="/Cart"},error:function(){alert($("span[id$=litError]").html().trim()),$(".dataTables_processing").css("visibility","hidden")}})}else alert(e)}function AddHintText(e,t){$("div#"+t+"_filter").parent().find("input").attr("class","hint"),$("div#"+t+"_filter").parent().find("input").attr("placeholder",e)}function EmailSelectedQuotes(){if($(".chk-quote:checked").length==0){alert(dataTableResources.litSelectQuotes);return}var e=[];$(".chk-quote:checked").each(function(){e.push($(this).data("quotenumber")+":"+$(this).data("guid"))}),$.ajax({url:"/api/OrderHistory/GetEncryptedQuoteIds",cache:!1,type:"POST",timeout:15e3,contentType:"application/json",data:JSON.stringify(e),success:function(e){$("a#lnkEmailQuote").attr("href","/OrderHistory/EmailQuotes.aspx?qs="+e+"&TB_iframe=true&height=250&width=450&modal=true"),typeof dataLayer!="undefined"&&dataLayer.push({event:"quotes_view_email_quote_modal_opened"}),$("a#lnkEmailQuote").trigger("click")},error:function(){alert($("span[id$=litError]").html().trim())}})}function BuySelectedQuotes(){if($(".chk-quote:checked").length==0){alert(dataTableResources.litSelectQuotesBuy);return}typeof dataLayer!="undefined"&&dataLayer.push({event:"quotes_view_buy_selected_clicked"}),$("a#lnkloader").trigger("click");var e=[];$(".chk-quote:checked").each(function(){e.push($(this).data("guid"))}),$.ajax({url:"/api/OrderHistory/BuySelectedQuotes",cache:!1,type:"POST",timeout:3e4,contentType:"application/json",data:JSON.stringify(e),success:function(e){typeof dataLayer!="undefined"&&dataLayer.push(e),window.location.href="/Cart"},error:function(){tb_remove(),alert($("span[id$=litError]").html().trim())}})}function CreateBomDataTable(){if($("table#tblBoms").length==0)return;$("a#lnkCreateNewBom").on("click",function(){$.ajax({url:"/OrderHistory/CreateNewBom",cache:!1,type:"GET",success:function(e){var t=$("div.error-container");e.ErrorMessage.length>0?t.hasClass("hidden")&&($("p#pErrorMessage").replaceWith(e.ErrorMessage),t.toggleClass("hidden"),$.scrollTo&&$.scrollTo(t,1e3,{easing:"easeInCubic",axis:"y"})):window.location=e.ReturnUrl},error:function(){}})});var e="",t=$("table#tblBoms").dataTable({bProcessing:!0,bAutoWidth:!1,sPaginationType:"ellipses",sServerMethod:"POST",bServerSide:!0,bJQueryUI:!0,bDeferRender:!0,iDisplayLength:25,sAjaxSource:"/api/OrderHistory/Boms?cultureCode="+encodeURIComponent(cultureCode)+"¤cyCulture="+encodeURIComponent(currencyCulture),sDom:'<"H"frli>t<"F"Tp>',aaSorting:[[2,"desc"]],oTableTools:{aButtons:[{sExtends:"text",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"btn btn-secondary",sButtonClassOverride:!0,sButtonText:dataTableResources.ExportPageToExcel,sFieldBoundary:'"',sFieldSeperator:",",mColumns:"visible",fnClick:function(e,t){var s=this.fnGetTableData(t);$.ajax({dataType:"text",type:"GET",cache:!1,timeout:15e3,url:"/OrderHistory/ExportToExcel",success:function(e){e&&ajax_download(e,s,"BOMs")}})}},{sExtends:"print_new",bShowAll:!1,sButtonText:dataTableResources.PrintPage,sInfo:dataTableResources.PrintView}]},aoColumns:[{mData:"BomNameDisplay",iDataSort:8,bSearchable:!1,sWidth:"20%",sClass:"bomname-col"},{mData:"Status",bSortable:!1,sWidth:"10%",bSearchable:!1},{mData:"DateCreatedDisplay",iDataSort:11,bSearchable:!1,sWidth:"10%"},{mData:"DateExpiresDisplay",iDataSort:25,bSearchable:!1,sWidth:"10%"},{mData:"LinesQuoted",iDataSort:27,bSearchable:!1,sWidth:"8%"},{mData:"BuyLink",bSortable:!1,bSearchable:!1,sWidth:"15%"},{mData:"ExportLink",bSortable:!1,bSearchable:!1,sWidth:"8%"},{mData:"DeleteLink",bSortable:!1,bSearchable:!1,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").on("click",function(){ConfirmDeleteBom(t,$(this).data("bomid"))}),$("a.cancel-bom").on("click",function(){ConfirmCancelBom(t,$(this).data("bomid"))}),DataLayerUtils.addDomEvents("click","data-datalayer-click","#divOrderHistoryGrid")},fnServerData:function(t,n,s,o){typeof dataLayer!="undefined"&&e!==($("#txtSearch").val()||"")&&(dataLayer.push({event:"saved_boms_search_boms_searched"}),e=$("#txtSearch").val()||""),o.jqXHR=$.ajax({dataType:"json",type:"POST",cache:!1,timeout:3e4,url:t,data:n,success:s,error:function(){$(".dataTables_processing").css("visibility","hidden")}})}}).fnSetFilteringDelay(1e3);AddHintText(dataTableResources.BomSearchText,"tblBoms"),$("div#tblBoms_filter").parent().find("input").attr("id","txtSearch"),$("div#tblBoms_filter").parent().find("select").attr("id","ddlPageSize"),$("a#ToolTables_tblBoms_0").attr("id","lnkExport"),$("a#ToolTables_tblBoms_1").attr("id","lnkPrint"),$("#divOrderHistoryGrid").on("click",".bom-display-name-link",function(){window.confirm($(this).data("confirm-text"))&&typeof dataLayer!="undefined"&&(dataLayer.push({event:"saved_boms_bom_name_clicked"}),window.location.href=$(this).data("href"))})}function ConfirmCancelBom(e,t){var n=$('<div><div class="bold alert alert-warning"><p>'+dataTableResources.CancelYourBom+"</p></div></div>");n.dialog({modal:!0,title:dataTableResources.CancelBomConfirm,draggable:!1,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(t),cache:!1,timeout:2e4,type:"POST",success:function(t){e.fnDeleteRow($(this).parents("tr")),t.length>0&&$("div.error-container").hasClass("hidden")&&$("label#lblAcctMessage").replaceWith(t)},error:function(){HandleError($("div.ui-dialog.cancel-bom"))}})}}]})}function ConfirmDeleteBom(e,t){var n=$('<div><div class="bold alert alert-warning"><p>'+dataTableResources.ConfirmDeleteBom+"</p></div></div>");n.dialog({modal:!0,title:dataTableResources.DeleteBomConfirmation,draggable:!1,dialogClass:"delete-bom",width:GetResponsiveModalWidth(500),height:GetResponsiveModalHeight(200),close:function(){typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_boms_delete_modal_closed_x"}),$(this).dialog("destroy")},buttons:[{id:"btnCancel",text:dataTableResources.btnCancel,class:"ui-button",click:function(){typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_boms_delete_modal_closed_cancel"}),$(this).dialog("destroy")}},{id:"btnConfirm",text:dataTableResources.confirm,class:"ui-button",click:function(){typeof dataLayer!="undefined"&&dataLayer.push({event:"saved_boms_delete_modal_confirmed"}),$(this).dialog("destroy"),$.ajax({url:"/api/OrderHistory/DeleteBomById?bomId="+encodeURIComponent(t),cache:!1,timeout:2e4,type:"POST",success:function(t){e.fnDeleteRow($(this).parents("tr")),t.length>0&&$("div.error-container").hasClass("hidden")&&$("label#lblAcctMessage").replaceWith(t)},error:function(){HandleError($("div.ui-dialog.delete-bom"))}})}}]})}function HandleError(e){e.find("div.alert-warning").removeClass("alert-warning").addClass("alert-danger"),e.find("div.alert-danger p").html(dataTableResources.CouldNotProcessRequest),e.find("button#btnConfirm").hide(),e.find("button#btnCancel").text(dataTableResources.btnBack)}function DeleteProject(e,t,n,s){$.ajax({url:"/api/OrderHistory/DeleteProjectByGuid?projectGuid="+encodeURIComponent(s),cache:!1,timeout:2e4,type:"POST",success:function(){e.dialog("destroy"),t.fnDeleteRow(n.parents("tr"))},error:function(){}})}function DisplayInfoModal(e,t,n){var s=$('<div id="saveChangesModal" class="confirmLicenseDialog"><p>'+e+"</p></div>");s.dialog({title:t,resizable:!1,modal:!0,width:440,height:200,maxHeight:550,close:function(e){$(this).dialog("destroy"),typeof n=="function"&&n(e)},buttons:[{id:"btnConfirm",text:dataTableResources.lnkClose,class:"ui-button",click:function(e){$(this).dialog("destroy"),typeof n=="function"&&n(e)}}]})}function SendMiniCartPageEventsToDataLayer(e,t){if(typeof dataLayer=="undefined")return;var n=t?"minicart_modal_paging_":"add_to_cart_modal_paging_",s={};switch(typeof e){case"number":n+="number",s.page_number=e;break;case"string":n+=e;break;default:return}s.event=n,dataLayer.push(s)}jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay=function(e,t){try{var n=this;return t===void 0&&(t=250),this.each(function(e){$.fn.dataTableExt.iApiIndex=e;var i=null,o=null,s=$("input",n.fnSettings().aanFeatures.f);return s.off("keyup").on("keyup",function(){(o===null||o!=s.val())&&(window.clearTimeout(i),o=s.val(),i=window.setTimeout(function(){$.fn.dataTableExt.iApiIndex=e,n.fnFilter(s.val())},t))}),this}),this}catch{return null}},$.extend($.fn.dataTableExt.oStdClasses,{sPageEllipsis:"paginate_ellipsis",sPageNumber:"paginate_number",sPageNumbers:"paginate_numbers"}),$.fn.dataTableExt.oPagination.ellipses={oDefaults:{iShowPages:5},fnClickHandler:function(e){var o=e.data.fnCallbackDraw,n=e.data.oSettings,t=e.data.sPage,s=e.data.sPageType;return!$(this).is("[disabled]")&&(n.oApi._fnPageChange(n,t),o(n),t!=="first"&&t!=="last"&&(t+=1),n.nTable.id==="tblMiniCart"&&(ga("send","event",MiniCart.IsCartHover?"Cart Hover":"Add to Cart Modal","Paging",t,MiniCart.TotalDisplayRecords),typeof s=="string"&&(t=s),SendMiniCartPageEventsToDataLayer(t,MiniCart.IsCartHover)),!0)},fnInit:function(e,t,n){var s=e.oClasses,o=e.oLanguage.oPaginate,i=this,u=e.oInit.iShowPages||this.oDefaults.iShowPages,m=Math.floor(u/2);$.extend(e,{_iShowPages:u,_iShowPagesHalf:m}),d=!1,typeof dataTablesOverrides!="undefined"&&dataTablesOverrides.useNewCode&&(d=!!dataTablesOverrides.useNewCode);var d,a=$('<a class="'+s.sPageButton+" "+s.sPageFirst+'">'+o.sFirst+"</a>"),r=$('<a class="'+s.sPageButton+" "+s.sPagePrevious+'">'+o.sPrevious+"</a>"),h=$('<span class="'+s.sPageNumbers+'"></span>'),c=$('<a class="'+s.sPageButton+" "+s.sPageNext+'">'+o.sNext+"</a>"),l=$('<a class="'+s.sPageButton+" "+s.sPageLast+'">'+o.sLast+"</a>");d?(a=$('<span class="'+s.sPageButton+" "+s.sPageFirst+' page-item cursor-pointer" ><button class="page-link" type="button">'+o.sFirst+"</button></span>"),r=$('<span class="'+s.sPageButton+" "+s.sPagePrevious+' page-item cursor-pointer" ><button class="page-link" type="button">'+o.sPrevious+"</button></span>"),h=$('<span class="'+s.sPageNumbers+'"></span>'),c=$('<span class="'+s.sPageButton+" "+s.sPageNext+' page-item cursor-pointer"><button class="page-link" type="button">'+o.sNext+"</button></span>"),l=$('<span class="'+s.sPageButton+" "+s.sPageLast+' page-item cursor-pointer"><button class="page-link" type="button">'+o.sLast+"</button></span>"),a.find(".page-link").on("click",{fnCallbackDraw:n,oSettings:e,sPage:"first"},i.fnClickHandler),r.find(".page-link").on("click",{fnCallbackDraw:n,oSettings:e,sPage:"previous"},i.fnClickHandler),c.find(".page-link").on("click",{fnCallbackDraw:n,oSettings:e,sPage:"next"},i.fnClickHandler),l.find(".page-link").on("click",{fnCallbackDraw:n,oSettings:e,sPage:"last"},i.fnClickHandler)):(a.on("click",{fnCallbackDraw:n,oSettings:e,sPage:"first"},i.fnClickHandler),r.on("click",{fnCallbackDraw:n,oSettings:e,sPage:"previous"},i.fnClickHandler),c.on("click",{fnCallbackDraw:n,oSettings:e,sPage:"next"},i.fnClickHandler),l.on("click",{fnCallbackDraw:n,oSettings:e,sPage:"last"},i.fnClickHandler)),$(t).append(a,r,h,c,l)},fnUpdate:function(e,t){var n,o,i,r,c,d,s=e.oClasses,l=this,a=e.nTableWrapper;this.fnUpdateState(e),c=!1,typeof dataTablesOverrides!="undefined"&&dataTablesOverrides.useNewCode&&(c=!!dataTablesOverrides.useNewCode),e._iCurrentPage===1?($(".first",a).addClass("ui-state-disabled d-none"),$("."+s.sPagePrevious,a).prop("disabled",!0)):($(".first",a).removeClass("ui-state-disabled d-none"),$("."+s.sPagePrevious,a).prop("disabled",!1)),e._iTotalPages===0||e._iCurrentPage===e._iTotalPages?($("."+s.sPageNext,a).prop("disabled",!0),$(".last",a).addClass("ui-state-disabled d-none")):($("."+s.sPageNext,a).prop("disabled",!1),$(".last",a).removeClass("ui-state-disabled d-none")),d=$("."+s.sPageNumbers,a),d.html("");for(r=e._iFirstPage;r<=e._iLastPage;r++)o=$('<a class="'+s.sPageButton+" "+s.sPageNumber+' page-number">'+e.fnFormatNumber(r)+"</a>"),c&&(o=$('<span class="'+s.sPageButton+" "+s.sPageNumber+' page-item page-number" ><button class="page-link" type="button">'+e.fnFormatNumber(r)+"</button></span>")),e._iCurrentPage===r?(o.attr("active",!0),c?(o.attr("aria-current","page"),o.addClass("active"),o.find(".page-link").removeClass("cursor-pointer").prop("disabled","disabled")):o.prop("disabled",!0)):c?(o.find(".page-link").addClass("cursor-pointer").removeProp("disabled"),o.find(".page-link").on("click",{fnCallbackDraw:t,oSettings:e,sPage:r-1},l.fnClickHandler)):o.on("click",{fnCallbackDraw:t,oSettings:e,sPage:r-1},l.fnClickHandler),d.append(o);n="",i="",1<e._iFirstPage&&(n=e._iCurrentPage-6,n<0&&(n=0),i=$('<a class="'+s.sPageButton+" "+n+' cursor-pointer ellipses-prev">...</a>'),c?(i=$('<span class="'+s.sPageButton+" "+n+' page-item ellipses-prev" ><button class="page-link" type="button">...</button></span>'),i.find(".page-link").on("click",{fnCallbackDraw:t,oSettings:e,sPage:n,sPageType:"prev"},l.fnClickHandler)):i.on("click",{fnCallbackDraw:t,oSettings:e,sPage:n,sPageType:"prev"},l.fnClickHandler),d.prepend(i)),n=e._iCurrentPage+4,e._iLastPage<e._iTotalPages&&(n>=e._iTotalPages&&(n=e._iTotalPages-1),i=$('<a class="'+s.sPageButton+" "+n+' cursor-pointer ellipses-next">...</a>'),c?(i=$('<span class="'+s.sPageButton+" "+n+' page-item ellipses-next" ><button class="page-link" type="button">...</button></span>'),i.find(".page-link").on("click",{fnCallbackDraw:t,oSettings:e,sPage:n,sPageType:"next"},l.fnClickHandler)):i.on("click",{fnCallbackDraw:t,oSettings:e,sPage:n,sPageType:"next"},l.fnClickHandler),d.append(i))},fnUpdateState:function(e){var o=Math.ceil((e._iDisplayStart+1)/e._iDisplayLength),t=Math.ceil(e.fnRecordsDisplay()/e._iDisplayLength),n=o-e._iShowPagesHalf,s=o+e._iShowPagesHalf;t<=1?$("table#"+e.sTableId).next().find(".dataTables_paginate").hide():$("table#"+e.sTableId).next().find(".dataTables_paginate").show(),t<e._iShowPages?(n=1,s=t):n<1?(n=1,s=e._iShowPages):s>t&&(n=t-e._iShowPages+1,s=t),$.extend(e,{_iCurrentPage:o,_iTotalPages:t,_iFirstPage:n,_iLastPage:s})}},jQuery.fn.dataTableExt.oApi.fnReloadAjax=function(e,t,n,s){if(jQuery.fn.dataTable.versionCheck){var o,i,r,a=new jQuery.fn.dataTable.Api(e);t?a.ajax.url(t).load(n,!s):a.ajax.reload(n,!s);return}if(t!=null&&(e.sAjaxSource=t),e.oFeatures.bServerSide){this.fnDraw();return}this.oApi._fnProcessingDisplay(e,!0),o=this,r=e._iDisplayStart,i=[],this.oApi._fnServerParams(e,i),e.fnServerData.call(e.oInstance,e.sAjaxSource,i,function(t){o.oApi._fnClearTable(e);for(var a=e.sAjaxDataProp!==""?o.oApi._fnGetObjectDataFn(e.sAjaxDataProp)(t):t,i=0;i<a.length;i++)o.oApi._fnAddData(e,a[i]);e.aiDisplay=e.aiDisplayMaster.slice(),o.fnDraw(),s===!0&&(e._iDisplayStart=r,o.oApi._fnCalculateEnd(e),o.fnDraw(!1)),o.oApi._fnProcessingDisplay(e,!1),typeof n=="function"&&n!==null&&n(e)},e)};function ShouldDisplayManagePermissionsModal(){var e=+$("select[id$=ddlBuyer] option:selected").val();return e===-1}function DisplayManagePermissionsModal(){if(typeof dataTablesOverrides!="undefined"&&dataTablesOverrides.useNewCode){DisplayCustomManagePermissionModal();return}$("div[id$=divLoadProgress]").css("display","block"),$(".dataTables_processing").css("visibility","hidden"),FetchManagePermissionModal()}function FetchManagePermissionModal(){$.get("/OrderHistory/ManagePermissions",function(e){if(e===""||e.length===0||e==="NotLoggedIn")$("div[id$=divLoadProgress]").css("display","none");else{var s,t=$.parseHTML(e),n=$("[id$=ddlBuyer]"),o=$("#divOHFilterLegendWrapper").length>0&&$("#divOHFilterLegendWrapper").attr("class")==="hidden";n.length>0&&!o?n.parent().append(t):($("#managePermissionsModal").length>0&&$("#managePermissionsModal").remove(),$("#divOrgManagePermission").append(t)),RebindJQueryValidation(),s=$("#ManagePermissionsForm").find(".field-validation-error"),s.each(function(){$(this).removeClass("field-validation-error"),$(this).addClass("field-validation-valid")}),$("#divGeneralError").addClass("hidden"),$("#VerifyGrant").prop("checked",!1),$("#VerifyRevoke").prop("checked",!1),$("#managePermissionsModal").modal()}})}$(document).on("show.bs.modal","#managePermissionsModal",function(){$("div[id$=divLoadProgress]").css("display","none")}),$(document).on("hide.bs.modal","#managePermissionsModal",function(){$("select[id$=ddlBuyer]").val("0"),$("select[id$=ddlBuyer]").trigger("change"),HideFormValidation()});function HideFormValidation(e){e&&e.length>0&&($(e).addClass("field-validation-valid"),$(e).removeClass("field-validation-error"))}$(document).on("click","#VerifyGrant",function(){$("#VerifyGrant:checked")&&HideFormValidation($("span[data-valmsg-for='VerifyGrant']"))}),$(document).on("click","#VerifyRevoke",function(){$("#VerifyRevoke:checked")&&HideFormValidation($("span[data-valmsg-for='VerifyRevoke']"))}),$("#divOrderHistoryGrid").on("focus","#tblOrderSearch_filter input",function(){dataLayer!==void 0&&dataLayer.push({event:"order_history_search_search_orders_clicked"})}),$(document).on("click","#ChangePermission",function(e){e.preventDefault(),$.ajax({type:"POST",dataType:"json",cache:!1,url:$("#ManagePermissionsForm").attr("action"),data:$("#ManagePermissionsForm").serialize(),success:function(e){if(e.Success===!0)$("select[id$=ddlBuyer]").val("0"),location.reload();else if(e.ErrorKey=="Verify"){var t=$("span[data-valmsg-for='VerifyGrant']");t&&t.length>0?($(t).html('<span for="VerifyGrant">'+$("#VerifyGrant").attr("data-val-requiredif")+"</span>"),$(t).removeClass("field-validation-valid"),$(t).addClass("field-validation-error"),$("#VerifyGrant").focus()):(t=$("span[data-valmsg-for='VerifyRevoke']"),t&&t.length>0&&($(t).html('<span for="VerifyRevoke">'+$("#VerifyRevoke").attr("data-val-requiredif")+"</span>"),$(t).removeClass("field-validation-valid"),$(t).addClass("field-validation-error")),$("#VerifyRevoke").focus())}else $("#divGeneralError").removeClass("hidden")},error:function(){$("#divGeneralError").removeClass("hidden")}})});function ShowActionsStatusToolTip(){try{var t=5,e=$("img[id$=actionsStatus]").offset();$("#actionStatusToolTip").attr("class","divStatusToolTip"),$("#actionStatusToolTip").css("top",e.top-t),$("#actionStatusToolTip").css("left",e.left-365)}catch{}}function HideActionsStatusToolTip(){try{$("[id$=actionStatusToolTip]").attr("class","hidden")}catch{}}function PrintScreen(){$("table#tblQuotesMVC").css("display","table"),dataLayer.push({event:"quotes_view_print_view_opened"}),window.print(),$("table#tblQuotesMVC").removeAttr("style")}function EmailSingleQuote(){if($(".chk-quote:checked").length==0||$(".chk-quote:checked").length>1){alert(Resources.MyMouser.SelectSingleQuoteMsg);return}typeof dataLayer!="undefined"&&dataLayer.push({event:"quotes_view_email_quote_modal_opened"}),$("#QuoteEmailModal").modal("toggle"),$("#QuoteEmailModal").find(".modal-title").text(Resources.MyMouser.EmailQuotePopUp+" ("+$(".chk-quote:checked").data("quotenumber")+")")}function sendEmail(){var e=validateEmail();if(e){const e=$("#emailInput"),t=e.val().trim();$("#QuoteEmailModal").modal("hide");const n=$("input[name='fileType']:checked").val(),s=$(".chk-quote:checked").data("guid");$.ajax({url:"/Quote/SendQuoteEmail",type:"POST",data:JSON.stringify({email:t,fileType:n,GUID:s}),contentType:"application/json",success:function(e){console.log("Success:",e)}})}}function validateEmail(){const t=$("#emailInput"),n=$("#emailError");n.text("").hide();const e=t.val().trim(),s=/^[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+@[a-zA-Z0-9]{1,63}(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:[.][a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;if(e==="")return displayError("required-error"),!1;const o=100;return e.length>o?(displayError("invalid-email-error"),!1):!!s.test(e)||(displayError("invalid-email-error"),!1)}function displayError(e){const t=$("#emailError");if(t){const n=$("span."+e).text();t.text(n).show()}}function BuySelectedQuotesWithSpinner(){$(".dataTables_processing").css("visibility","visible"),BuySelectedQuotes()}$("#btnExcelExport").on("click",function(){document.getElementById("ToolTables_tblQuotesMVC_0").click()})