xpoNlmModule.controller("PayableSelectionController",["$scope","payableSelectionData","purchaseService","carrierService","customersService",function(n,t,i,r,u){var f,e;n.PayableSelectionData=t;n.PurchaseService=i;n.CarrierService=r;n.CustomersService=u;n.displayResults=!1;n.searchInProgress=!1;n.updateInProgress=!1;f=function(n,t){n.sort(function(n,i){return n[t].toLowerCase()>i[t].toLowerCase()?1:n[t].toLowerCase()0&&(f(n.CarrierService.carriers,"Name"),n.PayableSelectionData.carriers=n.PayableSelectionData.defaultSelect("All Carriers").concat(n.CarrierService.carriers),n.PayableSelectionData.selected.Carrier=n.PayableSelectionData.carriers[0])},function(t,i){n.errorMessageCarriers="ERROR: ("+i+") "+t.Message;n.loadingCarriers=!1;n.displayErrorCarriers=!0});n.selectCarrier=function(t){n.PayableSelectionData.selected.Carrier=t};n.loadingCustomers=!0;n.CustomersService.getCustomers(function(){n.loadingCustomers=!1;n.CustomersService.customers.length>0&&(f(n.CustomersService.customers,"Name"),n.PayableSelectionData.customers=n.PayableSelectionData.defaultSelect("All Customers").concat(n.CustomersService.customers),n.PayableSelectionData.selected.Customer=n.PayableSelectionData.customers[0])},function(t,i){n.errorMessageCustomers="ERROR: ("+i+") "+t.Message;n.loadingCustomers=!1;n.displayErrorCustomers=!0});n.selectCustomer=function(t){n.PayableSelectionData.selected.Customer=t};n.setErrorMessage=function(t,i){var r=n.errorMessages.length+1;n.errorMessages.push(t+(i?" ("+i+") ":""))};n.clearErrors=function(){n.errorMessages=[]};n.clearAll=function(){var t=n.PayableSelectionData.selected;t.StartDate=null;t.EndDate=null;t.OlderXDays="";t.CurrencyId=1;t.Carrier=n.PayableSelectionData.carriers[0];t.Customer=n.PayableSelectionData.customers[0];t.IsPaid=!1;t.ToBeMarked=[];n.displayResults=!1};n.gridOptions={columns:[{field:"CarrierName",title:"Carrier",width:"150px"},{field:"CustomerName",title:"Customer",width:"160px"},{field:"ParentCustomerName",title:"Parent",width:"140px"},{field:"ModeGroup",title:"Mode Group",width:"100px"},{field:"Reference",title:"Reference",width:"100px"},{field:"ShipmentNumber",title:"Shipment #",width:"70px"},{field:"PurchaseType",title:"Purchase Type",width:"150px"},{field:"PurchaseTotal",title:"Purchase Total",width:"90px"},{field:"InvoiceTotalReceived",title:"Received",width:"70px"},{field:"InvoiceTotalAmount",title:"Invoiced",width:"70px"},{field:"Date",title:"Date",width:"70px"},{field:"MarkedBy",title:"Marked By",width:"90px"}],rowTemplate:'#:CarrierName #<\/td>#:CustomerName #<\/td>#:ParentCustomerName #<\/td>#:ModeGroup #<\/td>#:Reference #<\/td>#:ShipmentNumber #<\/td>#:PurchaseType #<\/td>#:kendo.toString(PurchaseTotal, "0.00") #<\/td>#:kendo.toString(InvoiceTotalReceived, "0.00") #<\/td>#:kendo.toString(InvoiceTotalAmount, "0.00") #<\/td>#:moment(Date).format("MM/DD/YYYY") #<\/td>#:MarkedBy #<\/td><\/tr>',toolbar:[{template:"
Select All<\/div>
UnMark All<\/div>
Mark for Payment<\/div>"}],sortable:!0,reorderable:!0,selectable:!0,height:600,navigatable:!1,scrollable:{virtual:!0},pageable:{info:!1,numeric:!1,previousNext:!1}};e=function(){return new kendo.data.DataSource({data:n.PurchaseService.searchResults,schema:{model:{fields:n.PurchaseService.searchResultsSchema}},pageSize:100})};n.setTotalsAllPurchases=function(){var i,t;for(n.PayableSelectionData.totalItemsSelected=0,n.PayableSelectionData.totalSelectedAmount=0,n.PayableSelectionData.totalUnSelectedAmount=0,n.PayableSelectionData.grandTotal=0,i=n.PurchaseService.searchResults,t=0;tr:!1;i.getStates(function(t){n.states=t;i.getCountriesList(function(t){n.countries=_.filter(t,function(t){return _.includes(n.states.map(n=>n.CountryId),t.CountryCodeId)})})},function(n,t){u(n.ExceptionMessage||n.Message||"An error occurred while attempting to retrieve states.",t)})}n.resolution={};n.okToSubmit=!0},function(n,i){u(n.ExceptionMessage||n.Message||`An error occurred while attempting to retrieve details for shipment ${t}.`,i)})};n.calculateETA=function(t,i,f){n.clearErrors();r.getGpsMileage(t,i?.StateName,f?.TwoDigitCode,n.alertDetails.DestinationLatitude,n.alertDetails.DestinationLongitude,n.alertDetails.CustomerId,!1,function(t){n.alertDetails.calculatedETA=t;n.alertDetails.ETACalculatedAttempts+=1},function(t,i){u(t.ExceptionMessage||t.Message,i);n.alertDetails.ETACalculatedAttempts+=1})};n.countryChanged=function(){var t=function(){return n.selectedCountry.CountryCodeId?states=_.filter(n.states,function(t){return t.CountryId===n.selectedCountry.CountryCodeId}):n.states};n.selectorStates=t()};n.clearErrors=function(){n.errorMessages=[]};n.shipmentNumberClick=function(){var t="/WebClient/EmptyNoMaps/#/admin-shipment/"+n.shipmentId;window.open(t,"_blank","height=900,width=1100,resizable=1,status=0,location=0,toolbar=0,menubar=0")};n.handleLocationChange=function(){n.resolution.LocationId=n.selectedLocation.Id;delete n.resolution.ContactId};n.cancel=function(){n.submitInProgress||window.close()};n.submit=function(){n.clearErrors();n.submitInProgress=!0;n.alertDetails.AlertTypeName==="CriticalShipment"&&(n.resolution.CalculatedEta=n.alertDetails.calculatedETA.CalculatedArrivalDateTime);i.submitAlertResolution(n.shipmentId,n.alertType,n.resolution,function(){n.submitInProgress=!1;window.close()},function(t){if(t.Errors)for(var i=0;i0?(n.shipmentId=t.shipmentId,f(n.shipmentId,n.alertType)):u("A valid shipment number was not provided.")}]);xpoNlmModule.controller("AsnSelectionModalController",["$scope","$uibModal","$uibModalInstance","unusedASNs",function(n,t,i,r){n.selectedASN=null;n.asnGridOptions={columns:[{field:"ASNNumber",title:"ASN Number"},{field:"BillOfLading",title:"BOL"},{field:"UnitNumber",title:"Unit #"},{field:"FinalConsigneeCode",title:"Final Consignee"}],selectable:!0,scrollable:!0,height:240};n.asnGridDataSource=new kendo.data.DataSource({data:r});n.okay=function(){i.close(n.selectedASN)};n.cancel=function(){i.dismiss("cancel")};n.asnGridRowSelected=function(t){var i=t.sender,r=i.dataItem(i.select());n.selectedASN=angular.copy(r)}}]);xpoNlmModule.controller("AutoTrackingCommentModalController",["$scope","alertTypeName","shipmentId","$uibModalInstance",function(n,t,i,r){n.alertTypeName=t;n.shipmentId=i;n.okay=function(){r.close(n.comment)};n.cancel=function(){r.dismiss("cancel")}}]);xpoNlmModule.controller("AutoTrackingController",["$scope","$rootScope","$interval","autoTrackingService",function(n,t,i,r){var f,s;n.alerts=[];n.showGridArray=[];f={type:1,text:null,filters:{CustomerIds:[],AlertTypes:[],ModeGroupIds:[],ModeTypeIds:[],ShipperId:null,ConsigneeId:null,CarrierId:null,IsMexicoInbound:!1,IsMexicoOutbound:!1,IsIntraMexico:!1}};n.isLoadingAlerts=!0;r.search(f).then(function(t){_.forEach(t,function(n){_.forEach(n),function(n){n.ShipperMustDepartTime=moment(value.ShipperMustDepartTime).isValid()?moment(value.ShipperMustDepartTime).format("YYYY-MM-DD HH:mm"):"";n.LastUpdate=moment(value.LastUpdate).isValid()?moment(value.LastUpdate).format("YYYY-MM-DD HH:mm"):"";n.ShipperEstimatedTimeArrival=moment(value.ShipperEstimatedTimeArrival).isValid()?moment(value.ShipperEstimatedTimeArrival).format("YYYY-MM-DD HH:mm"):"";n.ConsigneeEstimatedTimeArrival=moment(value.ConsigneeEstimatedTimeArrival).isValid()?moment(value.ConsigneeEstimatedTimeArrival).format("YYYY-MM-DD HH:mm"):""}});n.alerts=t;n.isLoadingAlerts=!1});var u=null,e=function(){var t=countdown(null,timeoutTime,countdown.MINUTES|countdown.SECONDS);t.value>0?n.timeLeft=t.toString():n.refreshAutoTracking()},o=function(){timeoutTime=moment().add(10,"minutes");e();u=n.$on("countdown",function(){e()})};countdown.setLabels("|s|m|h|d||||||","|s|m|h|d||||||"," "," ");s=i(function(){n.$broadcast("countdown")},1e3);o();n.refreshAutoTracking=function(){u&&u();n.timeLeft=null;t.$emit("refreshAutoTracking")};t.$on("autoTrackingRefreshed",function(){o();n.showGridArray=r.showOnRefreshArray});deregisterRefresh=t.$on("refreshAutoTracking",function(){r.search(r.refreshedSearchParams).then(function(i){_.forEach(i,function(n){_.forEach(n),function(n){n.ShipperMustDepartTime=moment(value.ShipperMustDepartTime).isValid()?moment(value.ShipperMustDepartTime).format("YYYY-MM-DD HH:mm"):"";n.LastUpdate=moment(value.LastUpdate).isValid()?moment(value.LastUpdate).format("YYYY-MM-DD HH:mm"):"";n.ShipperEstimatedTimeArrival=moment(value.ShipperEstimatedTimeArrival).isValid()?moment(value.ShipperEstimatedTimeArrival).format("YYYY-MM-DD HH:mm"):"";n.ConsigneeEstimatedTimeArrival=moment(value.ConsigneeEstimatedTimeArrival).isValid()?moment(value.ConsigneeEstimatedTimeArrival).format("YYYY-MM-DD HH:mm"):""}});n.alerts=i;t.$emit("autoTrackingRefreshed")})})}]);xpoNlmModule.controller("NotesFailuresUtilityController",["$scope","$routeParams","notesFailuresUtilityService","notesFailuresUtilityData",function(n,t,i,r){var u,o,f,e,s,h,c;n.NotesFailuresUtilityService=i;n.NotesFailuresUtilityData=r;n.loadingNotesFailures=!0;n.NotesFailuresUtilityService.getFailureNoteList(function(){n.NotesFailuresUtilityData.notesFailures=n.NotesFailuresUtilityData.defaultSelect("Note Failure Group").concat(n.NotesFailuresUtilityService.notesFailures);n.NotesFailuresUtilityData.selected.NoteFailure=n.NotesFailuresUtilityData.notesFailures[0];n.loadingNotesFailures=!1},function(t,i){n.errorMessageNotesFailures="ERROR: ("+i+") "+t.Message;n.displayErrorNotesFailures=!0;n.loadingNotesFailures=!1});n.selectNoteFailure=function(t){n.NotesFailuresUtilityData.selected.NoteFailure=t;t.Type==2?(n.NotesFailuresUtilityData.serviceFailures=n.NotesFailuresUtilityData.defaultSelect("Note Failure Type").concat(t.ServiceFailures),n.NotesFailuresUtilityData.selected.ServiceFailure=n.NotesFailuresUtilityData.serviceFailures[0]):(n.NotesFailuresUtilityData.serviceFailures=[],n.NotesFailuresUtilityData.selected.ServiceFailure={},n.NotesFailuresUtilityData.selected.Notes="")};n.selectServiceFailure=function(t){n.NotesFailuresUtilityData.selected.ServiceFailure=t;n.NotesFailuresUtilityData.selected.Notes=n.NotesFailuresUtilityData.selected.ServiceFailure.Id>-999?n.NotesFailuresUtilityData.selected.ServiceFailure.Name:""};u=function(t,i){var r=n.errorMessages.length+1;n.errorMessages.push(t+(i?" ("+i+") ":""))};n.clearErrors=function(){n.errorMessages=[]};o=function(t,i){var r=n.warningMessages.length+1;n.warningMessages.push(t+(i?" ("+i+") ":""))};n.clearWarnings=function(){n.warningMessages=[]};f=function(t,i){var r=n.successMessages.length+1;n.successMessages.push(t+(i?" ("+i+") ":""))};n.clearSuccesses=function(){n.successMessages=[]};e=function(){n.NotesFailuresUtilityData.notesFailures[0]&&n.selectNoteFailure(n.NotesFailuresUtilityData.notesFailures[0]);n.NotesFailuresUtilityData.selected.Notes="";n.NotesFailuresUtilityData.selected.ShipmentIds=""};e();s=function(n){return n.sort().filter(function(n,t,i){return!t||n!=i[t-1]})};h=function(n){var t;return isNaN(n)?!1:(t=parseFloat(n),(t|0)===t)};n.addNote=function(){var t,i,r,c,l;for(n.clearErrors(),n.clearWarnings(),n.clearSuccesses(),t=n.NotesFailuresUtilityData.selected,t.NoteFailure.Id==-999&&u("Note Failure Group is required!",null),t.NoteFailure.Type==2&&t.ServiceFailure.Id==-999&&u("Note Failure Type is required!",null),(t.Notes==null||t.Notes.length==0)&&u("Shipment Notes are required!",null),(t.ShipmentIds==null||t.ShipmentIds.length==0)&&u("Shipment Number(s) are required!",null),i=t.ShipmentIds.split(/\s+/g),i=s(i),r=0;r0||(n.insertInProgress=!0,c={},l=t.NoteFailure.Type==1?"notes":"failures",c.ShipmentIds=i,c.Id=t.NoteFailure.Type==1?t.NoteFailure.Id:t.ServiceFailure.Id,c.Note=t.Notes,n.NotesFailuresUtilityService.insert(l,c,function(t){var r=t.Shipments,i;if(r)for(i=0;ii[t]?1:n[t]i[t]?-1:0})};u.getCustomers(function(){n.RatesToolData.customers=u.customers},function(n){console.error(n)});n.loadingAccounts=!0;n.AccountsService.getAccounts(function(){n.loadingAccounts=!1;n.AccountsService.accounts.length>0&&(n.RatesToolData.accounts=n.RatesToolData.defaultSelect("Account").concat(n.AccountsService.accounts),n.RatesToolData.selected.Account=n.RatesToolData.accounts[0])},function(t,i){n.errorMessageAccounts="ERROR: ("+i+") "+t.Message;n.loadingAccounts=!1;n.displayErrorAccounts=!0});n.selectAccount=function(t){n.RatesToolData.selected.Account=t;t.Id>-999?(n.RatesToolData.customers=n.RatesToolData.defaultSelect("Customer").concat(u.customers.filter(n=>n.ParentId===t.Id)),n.RatesToolData.selected.Customer=n.RatesToolData.customers[0],s()):(n.RatesToolData.customers=[],n.RatesToolData.selected.Customer={})};n.selectCustomer=function(t){n.RatesToolData.selected.Customer=t;s()};n.RatesToolData.invoiceItemTypes=n.RatesToolData.defaultSelect("Invoice Item Type").concat(n.InvoiceItemTypeService.getInvoiceItemTypes().filter(n=>[8,9,10,42,57,98,143,144,174,175,176].includes(n.Id)));n.RatesToolData.selected.InvoiceItemType=n.RatesToolData.invoiceItemTypes[0];n.selectInvoiceItemType=function(t){n.RatesToolData.selected.InvoiceItemType=t};n.RatesService.getRateGroups(function(t){n.RatesToolData.rateGroups=n.RatesToolData.defaultSelect("Rate Group").concat(t);n.RatesToolData.selected.RateGroup=n.RatesToolData.rateGroups[0]},function(t,i){n.errorMessageRateGroups="ERROR: ("+i+") "+t.Message;n.displayErrorRateGroups=!0});n.selectRateGroup=function(t){n.RatesToolData.selected.RateGroup=t};n.ModeGroupsService.getModeGroupsWithFilter("ratestool",function(){n.RatesToolData.modeGroups=n.RatesToolData.defaultSelect("Mode Group").concat(n.ModeGroupsService.modeGroups);n.RatesToolData.modeGroups.splice(1,0,{Id:null,Name:"All"});n.RatesToolData.selected.ModeGroup=n.RatesToolData.modeGroups[0]},function(t,i){n.errorMessageModeGroups="ERROR: ("+i+") "+t.Message;n.displayErrorModeGroups=!0});n.selectModeGroup=function(t){n.RatesToolData.selected.ModeGroup=t;t.Id>-999&&t.Id!=null?(n.RatesToolData.modeTypes=n.RatesToolData.defaultSelect("Mode Type").concat(t.ModeTypes),n.RatesToolData.modeTypes.splice(1,0,{Id:null,Name:"All"}),n.RatesToolData.selected.ModeType=n.RatesToolData.modeTypes[0]):(n.RatesToolData.modeTypes=[],n.RatesToolData.selected.ModeType={})};n.selectModeType=function(t){n.RatesToolData.selected.ModeType=t};o=function(t,i){n.errorMessages.push(t+(i?" ("+i+") ":""))};n.clearErrors=function(){n.errorMessages=[]};l=function(n,t,i,r,u){n==-999&&o("Invoice Item Type is required!",null);t==-999&&o("Rate Group is required!",null);u==-999&&o("Mode Group is required!",null);i==null&&o("Amount is required!",null);r==null&&o("Effective Date is required!",null)};h=function(t,i,r,u,f,e,h,c,a,v){n.clearErrors();var y={},p=!1;if((v>0||v!=null)&&(p=!0,y.RateId=v),l(r,u,f,e,c),n.errorMessages.length>0){p&&angular.element("#currentResultsGrid").data("kendo-grid").dataSource.read();return}p?n.updateInProgress=!0:n.insertInProgress=!0;y.AccountId=t;y.InvoiceItemTypeId=r;y.RateGroupId=u;y.Amount=f;y.Effective=e;i>-999&&i!=null&&(y.CustomerId=i);h&&(y.Expires=h);c>-999&&c!=null&&(y.ModeGroupId=c,a>-999&&a!=null&&(y.ModeTypeId=a));n.RatesService.insertRate(y,function(){p?n.updateInProgress=!1:n.insertInProgress=!1;s()},function(t,i){o(t.Error,i);p?n.updateInProgress=!1:n.insertInProgress=!1})};n.gridCurrentOptions={columns:[{field:"Customer",title:"Customer Name",width:"120px"},{field:"InvoiceItemType",title:"Invoice Item Type",width:"170px"},{field:"RateGroup",title:"Rate Group",width:"120px"},{field:"ModeGroup",title:"Mode Group",width:"150px"},{field:"ModeType",title:"Mode Type",width:"150px"},{field:"Amount",title:"Amount",width:"100px",format:"{0:c}"},{field:"Inserted",title:"Inserted Date",width:"120px",template:"#=(moment(Inserted).isValid() ? moment(Inserted).format('MM/DD/YYYY HH:mm') : '')#"},{field:"Effective",title:"Effective Date",width:"120px",template:"#=(moment(Effective).isValid() ? moment(Effective).format('MM/DD/YYYY') : '')#"},{field:"Expires",title:"Expires Date",width:"120px",template:"#=(moment(Expires).isValid() ? moment(Expires).format('MM/DD/YYYY') : '')#"},{field:"Staff",title:"Staff",width:"150px"},{command:["edit"],title:" ",width:"220px"}],sortable:!0,reorderable:!0,selectable:!0,pageable:!1,editable:"inline",save:p};a=function(){return new kendo.data.DataSource({data:n.RatesService.currentRates,schema:{model:{id:"RateId",fields:{RateId:{type:"number",editable:!1,nullable:!1},Customer:{type:"string",editable:!1},InvoiceItemType:{type:"string",editable:!1},RateGroup:{type:"string",editable:!1},ModeGroup:{type:"string",editable:!1},ModeType:{type:"string",editable:!1},Amount:{type:"number",editable:!0},Inserted:{type:"date",editable:!1},Effective:{type:"date",editable:!0,nullable:!0},Expires:{type:"date",editable:!0,nullable:!0},Staff:{type:"string",editable:!1}}}}})};n.gridCurrentChange=function(t){var i=t.sender,r=i.dataItem(i.select());n.searchInProgress=!0;n.RatesService.getHistoryRates(r.RateId,function(){n.gridHistoryDataSource=v();n.searchHistoryResultsCount=n.RatesService.historyRates.length;n.searchHistoryResultsCount>0&&c(n.RatesService.historyRates,"Effective");n.displayHistoryResults=!0;n.searchInProgress=!1},function(t,i){o("An error occurred while retrieving rate history.",i);n.displayHistoryResults=!1;n.searchInProgress=!1})};s=function(){n.clearErrors();n.searchInProgress=!0;var t=n.RatesToolData.selected;n.RatesService.getCurrentRates(t.Account.Id,t.Customer.Id>0?t.Customer.Id:"",function(){n.gridCurrentDataSource=a();n.searchCurrentResultsCount=n.RatesService.currentRates.length;n.displayCurrentResults=!0;n.searchInProgress=!1},function(t,i){o("An error occurred while retrieving rates.",i);n.displayCurrentResults=!1;n.searchInProgress=!1})};n.gridHistoryOptions={columns:[{field:"Customer",title:"Customer Name",width:"120px"},{field:"InvoiceItemType",title:"Invoice Item Type",width:"170px"},{field:"RateGroup",title:"Rate Group",width:"120px"},{field:"ModeGroup",title:"Mode Group",width:"150px"},{field:"ModeType",title:"Mode Type",width:"150px"},{field:"Amount",title:"Amount",width:"100px",format:"{0:c}"},{field:"Inserted",title:"Inserted Date",width:"120px",template:"#=(moment(Inserted).isValid() ? moment(Inserted).format('MM/DD/YYYY HH:mm') : '')#"},{field:"Effective",title:"Effective Date",width:"120px",template:"#=(moment(Effective).isValid() ? moment(Effective).format('MM/DD/YYYY') : '')#"},{field:"Expires",title:"Expires Date",width:"120px",template:"#=(moment(Expires).isValid() ? moment(Expires).format('MM/DD/YYYY') : '')#"},{field:"Staff",title:"Staff",width:"150px"}],sortable:!0,reorderable:!0,selectable:!1,pageable:!1};v=function(){return new kendo.data.DataSource({data:n.RatesService.historyRates,schema:{model:{fields:n.RatesService.historyRatesSchema}}})};n.addRate=function(){var t=n.RatesToolData.selected;h(t.Account.Id,t.Customer.Id,t.InvoiceItemType.Id,t.RateGroup.Id,t.Amount,t.EffectiveDate,t.EndDate,t.ModeGroup.Id,t.ModeType.Id,null)}}]);xpoNlmModule.controller("AddEditeBulletinBoardMessageModalController",["$scope","$rootScope","$uibModal","$uibModalInstance","bulletinBoardService","addEditBulletinBoardData","AddOrEdit",function(n,t,i,r,u,f,e){"use strict";n.BulletinBoardService=u;n.AddEditBulletinBoardData=f;n.AddOrEdit=e,function(){var u=function(n){var r={templateUrl:t.WebClientPath+"/Modules/XpoNlm/Common/Views/MessageModal.html",controller:"MessageModalInstanceController",resolve:{message:function(){return n.ExceptionMessage?n.ExceptionMessage:n.Message?n.Message:typeof n=="string"?n:void 0},messageType:function(){return"error"}},windowClass:"small-Message-Modal mt-expedite-legacy"};i.open(r)};n.cancel=function(){r.dismiss("cancel")};n.submit=function(){n.hasErrors=!0;n.AddEditBulletinBoardData.EffectiveOn&&n.AddEditBulletinBoardData.Title&&n.AddEditBulletinBoardData.MessageDetails?(n.hasErrors=!1,n.AddOrEdit=="Add"?n.BulletinBoardService.insertNewsItem(n.AddEditBulletinBoardData,function(){var n={templateUrl:t.WebClientPath+"/Modules/XpoNlm/Common/Views/MessageModal.html",controller:"MessageModalInstanceController",resolve:{message:function(){return"Content Added!"},messageType:function(){return"success"}},windowClass:"small-Message-Modal mt-expedite-legacy"};i.open(n);r.close("saved")},u):n.BulletinBoardService.updateNewsItem(n.AddEditBulletinBoardData,function(){var u={templateUrl:t.WebClientPath+"/Modules/XpoNlm/Common/Views/MessageModal.html",controller:"MessageModalInstanceController",resolve:{message:function(){return"Content Updated!"},messageType:function(){return"success"}},windowClass:"small-Message-Modal mt-expedite-legacy"};i.open(u);r.close(n.AddEditBulletinBoardData)},u)):n.hasErrors=!0}}()}]);xpoNlmModule.controller("BulletinBoardController",["$rootScope","$scope","$routeParams","$uibModal","bulletinBoardService",function(n,t,i,r,u){"use strict";t.isCarrier=n.isImpersonatingCarrier||n.isCarrier;t.isAdmin=n.isAdmin&&!n.isImpersonatingCarrier;switch(i.defaultTab){case"1":t.tab1Selected=!0;break;case"2":t.tab2Selected=!0;break;case"3":t.tab3Selected=!0;break;case"4":t.tab4Selected=!0;break;default:t.tab1Selected=!0}t.bulletinBoardService=u;t.GeneralGridData=[];t.InvoicingGridData=[];t.HistoryGridData=[];t.DeletedGridData=[];t.AddEditBulletinBoardData={MessageId:null,Type:null,Title:null,MessageDetails:null,EffectiveOn:null};t.selectTab=function(n){t.tabSelected=n;return};t.addNewNewsItem=function(i){t.AddEditBulletinBoardData.Type=i;t.AddEditBulletinBoardData.Title=null;t.AddEditBulletinBoardData.MessageDetails=null;t.AddEditBulletinBoardData.EffectiveOn=null;t.AddEditBulletinBoardData.ContentTypeDescription="New Carrier Announcement";var u={backdrop:"static",controller:"AddEditeBulletinBoardMessageModalController",templateUrl:n.WebClientPath+"/Modules/XpoNlm/BulletinBoard/Views/AddEditeBulletinBoardMessageModal.html",resolve:{AddOrEdit:function(){return"Add"},addEditBulletinBoardData:function(){return t.AddEditBulletinBoardData}},windowClass:"mt-expedite-legacy"},f=r.open(u);f.result.then(function(){t.getBulletinBoardData()},angular.noop)};t.clearErrors=function(){t.errorMessages=[]};var f=function(n){t.displayResults=!0;t.searchInProgress=!1;t.GeneralGridData=_.filter(n,function(n){return n.Type=="General"&&n.Enabled&&moment(n.EffectiveOn).year()==moment().year()});t.InvoicingGridData=_.filter(n,function(n){return n.Type=="Invoicing"&&n.Enabled&&moment(n.EffectiveOn).year()==moment().year()});t.HistoryGridData=_.filter(n,function(n){return moment(n.EffectiveOn).year()"+t.model.ServiceFailureTypeCategoryDescription+"<\/span>").appendTo(n):$('').appendTo(n).kendoDropDownList({dataSource:v,dataTextField:"Name",dataValueField:"Id"})},c=function(n,t){$('').appendTo(n).kendoDropDownList({dataSource:y,dataTextField:"Name",dataValueField:"Id"})},l=function(n,t){$('').appendTo(n).kendoDropDownList({dataSource:p,dataTextField:"ServiceFailureTypeName",dataValueField:"ServiceFailureTypeId"})},a=function(n,t){t.model.IsSystemGenerated?$(""+t.model.ServiceFailureTypeName+"<\/span>").appendTo(n):$('').appendTo(n)},v=new kendo.data.DataSource({type:"json",transport:{read:function(n){i.getServiceFailureTypeCategories().then(function({data:t}){n.success(t)})}}}),y=new kendo.data.DataSource({type:"json",transport:{read:function(t){r.getCustomers(function(){n.customerList=r.customers;t.success(r.customers)},function(){})}}}),p=new kendo.data.DataSource({type:"json",transport:{read:function(t){i.getNewServiceFailures().then(function({data:i}){n.globalServiceFailures=i;t.success(i)},function(){})}}}),w=new kendo.data.DataSource({group:{field:"ServiceFailureTypeCategoryId"},type:"json",transport:{read:function(t){i.getNewServiceFailures().then(function({data:i}){n.globalServiceFailures=i;t.success(i)},function({data:n}){t.error(n)})},update:function(n){i.updateNewServiceFailures(n.data).then(function({data:t}){n.success(t)},function({data:t}){n.error(t)})},create:function(n){i.createNewServiceFailures(n.data).then(function({data:t}){n.success(t)},function({data:t}){n.error(t)})}},schema:{model:{id:"ServiceFailureTypeId",fields:{ServiceFailureTypeId:{from:"ServiceFailureTypeId",type:"number",editable:!1,nullable:!1},ServiceFailureTypeName:{from:"ServiceFailureTypeName",type:"string",editable:!0,required:!0},ServiceFailureTypeCategoryId:{from:"ServiceFailureTypeCategoryId",type:"number",editable:!0,required:!0},ServiceFailureTypeCategoryDescription:{from:"ServiceFailureTypeCategoryDescription",type:"string",editable:!1},IsActive:{from:"IsActive",type:"boolean",editable:!0},IsSystemGenerated:{from:"IsSystemGenerated",type:"boolean",editable:!1},IsDisputable:{from:"IsDisputable",type:"boolean",editable:!1},Points:{from:"Points",type:"number",editable:!0,required:!0}}}},page:1}),b=new kendo.data.DataSource({group:{field:"CustomerId"},type:"json",transport:{read:function(t){i.getNewServiceFailures().then(function({data:r}){n.globalServiceFailures=r;i.getNewServiceFailuresWithCustomer().then(function({data:i}){n.customerFailures=f(i);t.success(n.customerFailures)},function({data:n}){t.error(n)})})},update:function(t){i.updateNewServiceFailuresForCustomer(t.data).then(function(){i.getNewServiceFailures().then(function({data:r}){n.globalServiceFailures=r;i.getNewServiceFailuresWithCustomer().then(function({data:i}){n.customerFailures=f(i);t.success()},function({data:n}){t.error(n)})})},function({data:n}){t.error(n)})},create:function(t){t.data=ut(t.data);i.createNewServiceFailuresForCustomer(t.data).then(function(){i.getNewServiceFailures().then(function({data:r}){n.globalServiceFailures=r;i.getNewServiceFailuresWithCustomer().then(function({data:i}){n.customerFailures=f(i);t.success(t.data)},function({data:n}){t.error(n)})})},function({data:n}){t.error(n)})}},schema:{model:{id:"ID",fields:{ID:{from:"ID",type:"number",editable:!1,nullable:!0},FailureId:{from:"FailureId",type:"number",editable:!0,nullable:!0},FailureDescription:{from:"FailureDescription",type:"string",editable:!0,nullable:!0},CategoryDescription:{from:"CategoryDescription",type:"string",editable:!1},CustomerId:{from:"CustomerId",type:"number",editable:!0,required:!0},CustomerName:{from:"CustomerName",type:"string",editable:!0,required:!0},IsEnabled:{from:"IsEnabled",type:"boolean",editable:!0},Points:{from:"Points",type:"number",editable:!0,required:!0},ServiceFailureTypeId:{from:"ServiceFailureTypeId",type:"number",editable:!0,nullable:!1},ServiceFailureTypeName:{from:"ServiceFailureTypeName",type:"string",editable:!0,required:!0}}}},page:1}),k=[{field:"ServiceFailureTypeName",title:"Failure Type",type:"string",editor:a},{field:"ServiceFailureTypeCategoryId",title:"Category",type:"string",editor:h,template:"{{getCategory(dataItem)}}",groupHeaderTemplate:"#= items[0] && items[0].ServiceFailureTypeCategoryDescription ? items[0].ServiceFailureTypeCategoryDescription : '' #"},{field:"IsSystemGenerated",title:"Method",type:"string",template:"#=IsSystemGenerated ? 'System': 'User'#"},{field:"Points",title:"Points",type:"number"},{field:"IsActive",title:"Active",type:"boolean",template:'<\/input>'},{command:["edit"],title:" "}],d=[{field:"ServiceFailureTypeId",title:"Failure Type",type:"string",template:"{{getFailureNameFromServiceFailureTypeId(dataItem)}}",editor:l},{field:"CustomerId",title:"Customer",type:"string",editor:c,template:"{{getCustomerNameFromId(dataItem)}}",groupHeaderTemplate:"#= items[0] && items[0].CustomerName ? items[0].CustomerName : '' #"},{field:"Points",title:"Points",type:"number"},{field:"IsEnabled",title:"Active",type:"boolean",template:'<\/input>'},{command:["edit"],title:" "}],g={dataSource:w,toolbar:["create"],columns:k,sortable:!0,scrollable:!0,editable:"inline"},nt={dataSource:b,toolbar:[{name:"create",text:"Add Customer Specific Failure"}],columns:d,sortable:!0,scrollable:!0,editable:"inline"},tt=function(){i.getServiceFailureChangeLog().then(function(){u.open({templateUrl:t.WebClientPath+"/Modules/XpoNlm/CarrierExcellenceManager/Views/ChangeLogModal.html",controller:"CarrierExcellenceManagerModalInstanceController",size:"lg",windowClass:"mt-expedite-legacy"})})},o=function(t){var i=_.find(n.typeCategories,{Id:t.ServiceFailureTypeCategoryId});return i?i.Name:""},it=function(t){var i=_.find(n.globalServiceFailures,{ServiceFailureTypeId:t.FailureId});return o(i)},e=function(t){var i=_.find(n.customerList,{Id:t.CustomerId});return i?i.Name:""},s=function(t){var i=_.find(n.globalServiceFailures,{ServiceFailureTypeId:t.FailureId});return i?i.ServiceFailureTypeName:""},rt=function(t){var i=_.find(n.globalServiceFailures,{ServiceFailureTypeId:t.ServiceFailureTypeId});return i?i.ServiceFailureTypeName:""},f=function(n){return n.forEach(n=>{n.CustomerName=e(n),n.ServiceFailureTypeName=s(n),n.CategoryName=it(n),n.ServiceFailureTypeId=n.FailureId}),n},ut=function(n){return n.FailureId=n.ServiceFailureTypeId?n.ServiceFailureTypeId:n.FailureId,n.CustomerName=e(n),n.ServiceFailureTypeName=s(n),n};_.assign(n,{initialLoad:initialLoad,carrierExcellenceManagerOptions:g,customerExcellenceManagerOptions:nt,viewChangeLog:tt,getCategory:o,getCustomerNameFromId:e,getFailureNameFromServiceFailureTypeId:rt})}]);xpoNlmModule.controller("CarrierExcellenceManagerModalInstanceController",["$scope","CarrierExcellenceManagerService","$uibModalInstance",function(n,t,i){n.Cancel=function(){i.dismiss()};t.getServiceFailureChangeLog().then(function({data:t}){n.logs=t});t.getServiceFailureTypeCategories().then(function({data:t}){n.categories=t});n.getGroupMapping=function(t){var i=_.find(n.categories,{Id:Number(t)});return i?i.Name:""}}]);xpoNlmModule.controller("CarrierExcellenceController",["$rootScope","$scope","$window","$document","carrierFailuresService","accountsService","carrierTrustsService","appActiveUserService",function(n,t,i,r,u,f,e,o){"use strict";var h,s,a,c,l;t.CarrierFailuresService=u;t.AccountsService=f;t.TrustLocationService=e;t.errorMessages=[];h=function(){t.newServiceFailures=[];t.newObservationsFailures=[];t.acceptedObservationsFailures=[];t.acceptedServiceFailures=[];t.disputedServiceFailure=[];t.selectedShipFailures=[]};$(function(){h();t.selectedShipId=null;t.loadingAccount=!0;t.loadingTrustedLocation=!0;t.defaultTrustedLocations=[{Id:n.carrierId,Name:"-- Home Location --"},{Id:null,Name:"All Locations"}];t.defaultAccounts=[{Id:null,Name:"-- All Accounts --"}];var i=function(n){return n<=moment().month()?moment().year():moment().year()-1},r=function(n){return n<=moment().month()?moment(n+1+"-"+moment().year(),"MM-YYYY").toDate():moment(n+1+"-"+(moment().year()-1),"MM-YYYY").toDate()};t.months=[{Id:null,Name:"-- Current --",Value:null},{Id:0,Name:"January "+i(0),Value:r(0)},{Id:1,Name:"February "+i(1),Value:r(1)},{Id:2,Name:"March "+i(2),Value:r(2)},{Id:3,Name:"April "+i(3),Value:r(3)},{Id:4,Name:"May "+i(4),Value:r(4)},{Id:5,Name:"June "+i(5),Value:r(5)},{Id:6,Name:"July "+i(6),Value:r(6)},{Id:7,Name:"August "+i(7),Value:r(7)},{Id:8,Name:"September "+i(8),Value:r(8)},{Id:9,Name:"October "+i(9),Value:r(9)},{Id:10,Name:"November "+i(10),Value:r(10)},{Id:11,Name:"December "+i(11),Value:r(11)}];t.selectedMonthValue=_.first(t.months).Value});var v=function(){f.accounts.length&&(t.AccountsService.accounts=t.defaultAccounts.concat(f.accounts),t.selectedAccountId=_.first(t.AccountsService.accounts).Id,t.loadingAccount=!1,t.search())},y=function(){e.carrierTrusts.length&&(t.TrustLocationService.trustedLocations=t.defaultTrustedLocations.concat(e.carrierTrusts),t.selectedTrustedLocationId=_.find(t.TrustLocationService.trustedLocations,{Name:"All Locations"}).Id,t.loadingTrustedLocation=!1,f.getCarrierAccounts(v,s))},p=function(){u.searchResults.forEach(function(n){switch(n.StatusId){case-1:n.IsObservation||t.newServiceFailures.push(n);n.IsObservation&&t.newObservationsFailures.push(n);break;case 0:t.selectedMonthValue!=null?(n.IsObservation||t.acceptedServiceFailures.push(n),n.IsObservation&&t.acceptedObservationsFailures.push(n)):t.acceptedServiceFailures.push(n);break;case 1:t.disputedServiceFailure.push(n);break;case-2:t.selectedMonthValue!=null?(n.IsObservation||t.acceptedServiceFailures.push(n),n.IsObservation&&t.acceptedObservationsFailures.push(n)):t.acceptedServiceFailures.push(n);break;case 2:t.disputedServiceFailure.push(n);break;case 3:t.selectedMonthValue==null&&t.disputedServiceFailure.push(n);break;case 5:t.disputedServiceFailure.push(n)}var i=[];(t.selectedMonthValue==null||t.newServiceFailures.length>0)&&i.push({FailureName:"New Service Failures",FailureCount:t.newServiceFailures.length,Section:"NS"});(t.selectedMonthValue==null||t.newObservationsFailures.length>0)&&i.push({FailureName:"New Observation Failures",FailureCount:t.newObservationsFailures.length,Section:"NO"});i.push({FailureName:"Accepted Service Failures",FailureCount:t.acceptedServiceFailures.length,Section:"AS"});i.push({FailureName:"Disputed Service Failures",FailureCount:t.disputedServiceFailure.length,Section:"DS"});t.selectedMonthValue!=null&&i.push({FailureName:"Accepted Observations",FailureCount:t.acceptedObservationsFailures.length,Section:"AO"});t.parentgridDataSource=new kendo.data.DataSource({data:i});t.searchInProgress=!1});t.displayResults=u.searchResults.length>0?!0:!1;t.searchInProgress=!1};t.clearErrors=function(){t.errorMessages=[]};s=function(n,i){t.searchInProgress=!1;n.Error?t.errorMessages.push(n.Error+(i?" ("+i+") ":"")):t.errorMessages.push(n.Message+" ("+n.ExceptionMessage+") "+(i?" ("+i+") ":""))};a=function(){o.activeId!=null&&e.getCarrierTrusts(o.activeId,y,s)};o.subscribe(a);t.search=function(){t.clearErrors();t.searchInProgress=!0;h();var i={CustomerId:t.selectedAccountId,ShipmentId:t.selectedShipId,MonthSearch:t.selectedMonthValue,AwardedCarrierId:t.selectedTrustedLocationId};u.getSearchResultsByCarrier(n.carrierId,i,p,s)};t.selectedAccountIdChanged=t.search;t.selectedTrustedLocationIdChanged=t.search;t.selectedMonthValueChanged=t.search;t.clearAll=function(){t.selectedMonthValue=_.first(t.months).Value;t.selectedAccountId=_.first(t.AccountsService.accounts).Id;t.selectedTrustedLocationId=_.first(t.TrustLocationService.trustedLocations).Id;t.selectedShipId=null};t.parentGridOptions={sortable:!0,dataBound:function(){this.expandRow(this.tbody.find("tr.kl-master-row").first())},columns:[{field:"FailureName",title:"Failure Name",template:"#=FailureName#<\/strong><\/span> #=FailureCount#<\/strong><\/span>",headerAttributes:{style:"display: none"}}]};c=function(n){var i=[];switch(n){case"NS":i=t.newServiceFailures;break;case"NO":i=t.newObservationsFailures;break;case"AO":i=t.acceptedObservationsFailures;break;case"AS":i=t.acceptedServiceFailures;break;case"DS":i=t.disputedServiceFailure}return i};t.viewShipmentDetails=function(n){var r;r="/WebClient/ShipmentDetails/#/ShipmentDetails/"+n;i.open(r,"details","width=1200px,height=700px,scrollbars=yes,toolbar=0,menubar=1,resizable=1");t.shipmentNumber=null};l=[{field:"ShipmentId",title:"Shipment #",template:"#=ShipmentId#/#=SCAC#<\/a> "},{field:"Failure",title:"Failure",template:"#=Failure#<\/span>"},{field:"IssuedDate",title:"Issued",template:"#= moment(IssuedDate).format('MM/DD/YYYY HH:mm')#"},{field:"Consignee",title:"Consignee"},{field:"ExpireDate",title:"Expires",template:"#= moment(ExpireDate).format('MM/DD/YYYY HH:mm')#"}];t.child1GridOptions=function(n){return{dataSource:{data:c(n.Section,!1)},scrollable:!1,sortable:!0,pageable:!1,selectable:"row",columns:l}};t.childGridOptions=function(n){return{dataSource:{data:c(n.Section,!1),group:{field:"Status",dir:"asc"}},groupable:!1,scrollable:!1,sortable:!0,pageable:!1,selectable:"row",columns:l}};t.gridRowSelect=function(n){var r=n.sender,i,u;t.selectedShipFailures=[];i=[];_.forEach(r.select(),function(n){var u=r.dataItem(n);t.selectedShipFailures.push(u);i.push(u.uid)});t.displayNote=!0;$("tr.kl-state-selected").each(function(){var n=$(this)[0].dataset.uid;_.findIndex(i,function(t){return t==n})==-1&&$(this).removeClass("kl-state-selected")});u=$(n.sender.element).closest(".kl-detail-row").prev(".kl-master-row");$(u).addClass("kl-state-selected")};angular.element(r).find("html").addClass("carrier-failures");t.$on("$destroy",function(){angular.element(r).find("html").removeClass("carrier-failures")});t.launchScoreCard=function(){var t="/WebClient/Popup/#/CarrierScorecard/"+n.carrierId+"/Name/";window.open(t,"Carrier Score Card","width = 1300px, height = 800px, scrollbars = no, toolbar = 0, menubar = 1, resizable = 1")}}]);xpoNlmModule.controller("CarrierFailuresController",["$scope","$routeParams","$document","carrierFailuresService","accountsService","modeGroupsService",function(n,t,i,r,u,f){"use strict";var e,s,o;n.ModeGroupsService=f;n.AccountsService=u;n.CarrierFailuresService=r;$(function(){n.defaultAccounts=[{Id:null,Name:"All Accounts"}];n.defaultModeGroups=[{Id:null,Name:"All Mode Groups"}];t.shipmentId&&(n.selectedShipId=t.shipmentId);n.selectedShipId=null;n.selectedSCAC=null;n.displayNote=!1;n.loadingAccount=!0;n.loadingModeGroup=!0;n.loadingStatus=!0});var h=function(){r.statuses.length&&(n.CarrierFailuresService.statuses=r.statuses,n.selectedStatus=_.first(n.CarrierFailuresService.statuses.filter(function(n){return n.Name=="Newly Disputed"})),n.loadingStatus=!1)},c=function(){f.modeGroups.length&&(n.ModeGroupsService.modeGroups=n.defaultModeGroups.concat(f.modeGroups),n.selectedModeGroup=_.first(n.ModeGroupsService.modeGroups),n.loadingModeGroup=!1)},l=function(){u.accounts.length&&(n.AccountsService.accounts=n.defaultAccounts.concat(u.accounts),n.selectedAccount=_.first(n.AccountsService.accounts),n.loadingAccount=!1)},a=function(){n.OpsGroupState=null;n.BillingGroupState=null;n.newOpsGrid.options.selectable=n.selectedStatus.Id==-255||n.selectedStatus.Id==1?"multiple":"row";n.newBillingGrid.options.selectable=n.selectedStatus.Id==-255||n.selectedStatus.Id==1?"multiple":"row";n.opsCounts=r.failuresOperation.length;n.newOpsGridDataSource!=null&&(n.GroupState=n.newOpsGridDataSource.group());n.newOpsGridDataSource=new kendo.data.DataSource({data:r.failuresOperation});n.GroupState!=null&&n.newOpsGridDataSource.group(n.GroupState);n.billCounts=r.failuresBilling.length;n.newBillingGridDataSource!=null&&(n.BillingGroupState=n.newBillingGridDataSource.group());n.newBillingGridDataSource=new kendo.data.DataSource({data:r.failuresBilling});n.BillingGroupState!=null&&n.newBillingGridDataSource.group(n.BillingGroupState);n.displayResults=r.searchResults.length>0?!0:!1;n.searchInProgress=!1};n.clearErrors=function(){n.errorMessages=[]};e=function(t,i){n.searchInProgress=!1;var r=n.errorMessages.length+1;t.Error?n.errorMessages.push(t.Error+(i?" ("+i+") ":"")):n.errorMessages.push(t.Message+" ("+t.ExceptionMessage+") "+(i?" ("+i+") ":""))};n.selectStatus=function(t){n.selectedStatus=t};n.selectModeGroup=function(t){n.selectedModeGroup=t};n.selectAccount=function(t){n.selectedAccount=t};r.getStatus(h,e);f.getModeGroupsWithFilter("carrierfailures",c,e);u.getAccounts(l,e);n.search=function(){var t,i;if(n.selectedStartDate==null||n.selectedEndDate==null)switch(n.selectedStatus.Id){case-255:case 0:case 3:case 5:case-1:case-2:alert("You must enter a Start Date and End Date when searching for 'Unapproved', 'Accepted by Carrier', 'Dispute Honored', 'Rejected', or 'No Response/expired' failures.");return}n.displayResults=!1;n.displayNote=!1;n.searchInProgress=!0;n.clearErrors();n.selectedShipFailures=[];t=[];n.selectedModeGroup.Id!=null&&t.push(n.selectedModeGroup.Id);i={CustomerId:n.selectedAccount.Id,StartDate:n.selectedStartDate,EndDate:n.selectedEndDate,ModeGroupIds:t.length==0?null:t,CarrierSCAC:n.selectedSCAC,StatusId:n.selectedStatus.Id,ShipmentId:n.selectedShipId};r.getSearchResultsByAdmin(i,a,e)};n.clearAll=function(){n.selectedStatus=n.CarrierFailuresService.statuses.filter(function(n){return n.Name=="Newly Disputed"})[0];n.selectedModeGroup=n.ModeGroupsService.modeGroups[0];n.selectedAccount=n.AccountsService.accounts[0];n.selectedStartDate=null;n.selectedEndDate=null;n.selectedSCAC=null;n.selectedShipId=null;n.displayResults=!1;n.selectedShipFailures=[]};n.onSelect=function(){n.displayNote=!1;n.selectedShipFailures=[];return};s=[{field:"ShipmentId",title:"Shipment #",width:"90px",template:"#=ShipmentId#<\/a> ",filterable:!1},{field:"ModeGroupId",title:"Mode Group",width:"90px",template:function(n){return o(n.ModeGroupId)},filterable:!1},{field:"Failure",title:"Failure",width:"190px",filterable:!1},{field:"CarrierSCAC",title:"SCAC",width:"55px",filterable:!1},{field:"CarrierName",title:"Carrier",filterable:!1},{field:"ShipperName",title:"Shipper",filterable:!1},{field:"ShipperCityState",title:"Shipper City/State",filterable:{operators:{string:{contains:"Contains",doesnotcontain:"Doesn't contain"}}}},{field:"ShipperCountry",title:"Shipper Country",filterable:{operators:{string:{contains:"Contains",doesnotcontain:"Doesn't contain"}}}},{field:"DestinationName",title:"Consignee",filterable:!1},{field:"DestinationCityState",title:"Dest. City/State",filterable:{operators:{string:{contains:"Contains",doesnotcontain:"Doesn't contain"}}}},{field:"DestinationCountry",title:"Destination Country",filterable:{operators:{string:{contains:"Contains",doesnotcontain:"Doesn't contain"}}}},{field:"InsertedBy",title:"Generated By",filterable:{operators:{string:{contains:"Contains",doesnotcontain:"Doesn't contain"}}}},{field:"IssuedDate",title:"Issued",template:"#= moment(IssuedDate).format('MM/DD/YYYY HH:mm')#",width:"120px",filterable:!1},{field:"CustomerName",title:"Account",filterable:!1}];n.newOpsGridOptions={height:500,excelExport:function(n){for(var r,i,t,f=n.workbook.sheets[0],u=1;u"+o(n.OriginAddress)+"
"+n.OriginCity+", "+n.OriginState};r.finalPopup=function(n){return o(n.FinalName)+"
"+o(n.FinalAddress)+"
"+n.FinalCity+", "+n.FinalState};var s=[{field:"Status",title:"Status",width:"80px",template:'#if (ModeGroupId == 3 || ModeGroupId == 4){if (IsCarrierCostRequired){#
Shipment Carrier Cost<\/a>#}else if (DryRun == 1){#Dry Run#}else if (Status < 4){#Update In Origin#}else if (Status == 4){#Update Out Origin, Forwarding, ETA Destination#}else if (Status == 5){#Update In Destination#}else if (Status == 6){#Update POD#}else if (Status == 7 || Void == 2 || (FinalDepart != "0001-01-01T00:00:00" && POD && EPODStatus == 0)){#Shipment has been completed#}}else {if (IsCarrierCostRequired){#Shipment Carrier Cost<\/a>#}else if (DryRun == 1){#Dry Run#}else if (Status < 3){#Update Unit Number#}else if (Status == 3){#Update In Origin#}else if (Status == 4){#Update Out Origin, Forwarding, ETA Destination#}else if (Status == 5){#Update In Destination#}else if (Status == 6){#Update Out Destination, POD#}else if (Status == 7 || Void == 2 || (FinalDepart != "0001-01-01T00:00:00" && POD && EPODStatus == 0)){#Shipment has been completed#}}#'},{field:"ShipmentId",title:"Shipment #",width:"110px",template:"#if (RoundTrip){#[R] <\/span>#}##=ShipmentId#<\/a> "},{field:"ProNumber",title:"PRO #",width:"100px"},{field:"ProtectTime.DateTime",headerTemplate:"Protect
Time",template:'#if(ProtectTime.DateTime != ""){##=moment(ProtectTime.DateTime).format("MM/DD/YYYY HH:mm")# #=ProtectTime.TimeZone#<\/span>#}#',title:"Protect Time",width:"100px"},{field:"OriginETA.DateTime",headerTemplate:"ETA to
Pickup",template:'#if(OriginETA.DateTime != ""){##=moment(OriginETA.DateTime).format("MM/DD/YYYY HH:mm")# #=OriginETA.TimeZone#<\/span>#}#',title:"ETA to Pickup",width:"100px"},{field:"FinalETA.DateTime",headerTemplate:"ETA to
Delivery",template:'#if(FinalETA.DateTime != "" && FinalETA.DateTime > ProtectTime.DateTime){##=moment(FinalETA.DateTime).format("MM/DD/YYYY HH:mm")#<\/span> #} else if(FinalETA.DateTime != ""){##=moment(FinalETA.DateTime).format("MM/DD/YYYY HH:mm")# #=FinalETA.TimeZone#<\/span>#}#',title:"ETA to Delivery",width:"100px"},{title:"Shipper",columns:[{field:"OriginName",title:"Name",width:"150px",template:'#if(OriginDockName){##=OriginName# - #=OriginDockName#<\/span>#}else{##=OriginName#<\/span>#}#'},{field:"OriginState",title:"State",width:"150px",template:"#=OriginCity#, #=OriginState#",headerTemplate:"City, State"}]},{title:"Consignee",columns:[{field:"FinalName",template:'#if(FinalDockName){##=FinalName# - #=FinalDockName#<\/span>#}else{##=FinalName#<\/span>#}#',title:"Name",width:"150px"},{field:"FinalState",headerTemplate:"City, State",template:"#=FinalCity#, #=FinalState#",title:"State",width:"150px"}]},{field:"ModeGroupName",headerTemplate:"Account
Mode Group",template:"#=ParentName#
#=ModeGroupName#",title:"Mode Group",width:"120px"},{field:"UnitNumber",title:"Unit",width:"90px"},{field:"Hazmat",template:"#if(Hazmat){#Class: #=HazmatClass#'\">Yes<\/span>#}else{#No<\/span>#}#",title:"Hazmat",width:"100px"},{field:"MexicoBorderStopExists",template:"#if(MexicoBorderStopExists){#Yes<\/span>#}else{#No<\/span>#}#",headerTemplate:"MX Border
Stop",title:"MX Border Stop",width:"100px"}],h=function(n){for(var u,i,t,f,e=_.first(n.workbook.sheets),r=1;ru?1:0})},t=new kendo.data.DataSource({data:n(e.searchResults,"Status"),schema:{model:{fields:e.searchResultsSchema}}});_.assign(r,{displayResults:!0,displaySearching:!1,gridDataSource:t,searchResultsCount:e.searchResults.length})},t=function(n,t){var u,i;if(r.searchErrors=[],t===400)for(i=0;i",width:"50px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{command:["edit"],title:"Options",width:"180px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}}],editable:"inline"};n.FilterByLocation=function(t,i){n.locationSearched=!0;n.selectedLocationId=t;n.searchParams.CarrierId=t;n.selectedLocationName=i.locationName;u.read()}}]);xpoNlmModule.controller("CarrierScorecardController",["$scope","$rootScope","$routeParams","carrierService",function(n,t,i,r){function u(n,t){$('').appendTo(n).kendoNumericTextBox({spinners:!1,format:"{0:n0}"})}n.errors="";n.CarrierId=i.carrierId;n.CarrierName=i.carrierName;n.startDate=new Date;Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};n.ValidateValues=function(t){return!Number.isInteger(t.ThreeMonthAverage)||t.ThreeMonthAverage<0||t.ThreeMonthAverage>100?(n.errors="Three Month Average must be a whole number between 0 and 100",!1):!Number.isInteger(t.MonthlyScore)||t.MonthlyScore<0||t.MonthlyScore>100?(n.errors="Total Points must be a whole number between 0 and 100",!1):!Number.isInteger(t.GPSPercentage)||t.GPSPercentage<0||t.GPSPercentage>100?(n.errors="GPS Percentage must be a whole number between 0 and 100",!1):!0};var f=new kendo.data.DataSource({transport:{read:function(t){r.getCarrierScores(n.CarrierId,n.startDate.toISOString().split("T")[0]).then(function({data:i}){t.success(i);n.errors=[]},function({data:n}){t.error(n)})},update:function(t){n.ValidateValues(t.data)?(r.updateCarrierScore(n.CarrierId,t.data.ScoreCardId,t.data).then(function({data:i}){t.success(i);n.errors=[]},function({data:i}){t.error(i);n.errors=i.Error}),n.$apply()):(t.error(n.errors),n.$apply())}},schema:{model:{id:"ScoreCardId",fields:{CustomerId:{editable:!1},CustomerName:{editable:!1},ModeGroup:{editable:!1},BillingCount:{editable:!1},CommunicationCount:{editable:!1},PerformanceCount:{editable:!1},CapacityCount:{editable:!1},SafetyCount:{editable:!1},YBids:{editable:!1},NBids:{editable:!1},PBids:{editable:!1},IgnBids:{editable:!1},MonthlyScore:{editable:!0,type:"number",validation:{min:0,max:100,required:!0}},ThreeMonthAverage:{editable:!0,type:"number",validation:{min:0,max:100,required:!0}},ExportCount:{editable:!1},TotalShipments:{editable:!1},GPSPercentage:{editable:!0,type:"number",validation:{min:0,max:100,required:!0}},ScoreCardId:{editable:!1}}}},group:{field:"CustomerName"}});n.gridOptions={dataSource:f,columns:[{field:"CustomerName",groupHeaderTemplate:"#=value#",hidden:!0},{field:"TotalShipments",title:"Shipments Handled",headerAttributes:{style:"white-space: normal"}},{field:"BillingCount",title:"Billing Failures",headerAttributes:{style:"white-space: normal"}},{field:"CommunicationCount",title:"Communication Failures",headerAttributes:{style:"white-space: normal"}},{field:"PerformanceCount",title:"On Time Failures",headerAttributes:{style:"white-space: normal"}},{field:"CapacityCount",title:"Capacity Failures",headerAttributes:{style:"white-space: normal"}},{field:"SafetyCount",title:"Safety Failures",headerAttributes:{style:"white-space: normal"}},{field:"ExportCount",title:"Total Exports",headerAttributes:{style:"white-space: normal"}},{field:"YBids",title:"Accepted"},{field:"NBids",title:"Declined"},{field:"PBids",title:"No w/Best",headerAttributes:{style:"white-space: normal"}},{field:"IgnBids",title:"Ignored"},{field:"MonthlyScore",title:"Total Points",format:"{0:n0}",headerAttributes:{style:"white-space: normal"},editor:u},{field:"ThreeMonthAverage",title:"Three Mo. Avg.",format:"{0:n0}",headerAttributes:{style:"white-space: normal"},editor:u},{field:"GPSPercentage",title:"GPS %",format:"{0:n0}",editor:u},{command:["edit"],title:"Options",width:"180px",hidden:t.isCarrier||t.isImpersonatingCarrier}],editable:"inline",scrollable:!1,edit:function(){n.errors=[]},cancel:function(){n.errors=[]}};n.$watch("startDate",function(n,t){_.isEqual(n,t)||f.read()});n.monthSelectorOptions={start:"year",depth:"year",value:n.startDate}}]);xpoNlmModule.controller("CommodityManagerController",["$scope","commodityManagerService",function(n,t){function f(t,i){angular.element('').appendTo(t).kendoDropDownList({autoBind:!1,height:1e3,dataSource:{transport:{read:function(t){var i=n.modeGroups;n.allCustomersSelected&&(i=_.filter(n.modeGroups,function(n){return n.Id===r||n.Id===u}));t.success(_.map(i,"Name"))}}}})}var r,u,i;n.errors=[];r=7;u=9;i=new kendo.data.DataSource({transport:{read:function(i){t.getCommodityGrid(n.customer).then(function({data:t}){i.success(t);n.errors=[]})},update:function(i){var r=_.find(n.modeGroups,{Name:i.data.ModeGroupName});r!=null&&(i.data.ModeGroupId=r.Id);t.updateCommodity(i.data).then(function({data:t}){i.success(t);n.errors=[]})},create:function(i){var r=_.find(n.modeGroups,{Name:i.data.ModeGroupName});r!=null&&(i.data.ModeGroupId=r.Id);i.data.CustomerId=n.customer;t.insertNewCommodity(i.data).then(function({data:t}){i.success(t);n.errors=[]},function({data:t}){n.errors=t.ModelState.commodity})}},schema:{model:{id:"Id",fields:{Id:{editable:!1,nullable:!0},CustomerId:{editable:!1},Name:{validation:{required:!0}},ModeGroupName:{validation:{required:!0}},ModeGroupId:{editable:!1,nullable:!0},IsCSAEligible:{type:"boolean"},IsEnabled:{type:"boolean"}}}}});t.getModeGroups().then(function({data:t}){n.modeGroups=t;_.prepend(n.modeGroups,{Id:null,Name:"All Mode Groups"})});t.getCustomerList().then(function({data:t}){n.customers=t.filter(n=>n.Status!==0);_.prepend(n.customers,{Id:-999,Name:"All Customers"});_.prepend(n.customers,{Id:-1,Name:"--- Please Select ---"})});n.gridOptions={dataSource:i,toolbar:["create"],columns:[{field:"Name",title:"Commodity"},{field:"ModeGroupName",title:"Mode Group",editor:f},{field:"IsCSAEligible",title:"CSA Eligible",template:""},{field:"IsEnabled",title:"Enabled",template:""},{command:["edit"],title:"Options"}],editable:"inline"};n.$watch("customer",function(n,t){_.isEqual(n,t)||i.read()});Object.defineProperty(n,"allCustomersSelected",{get:function(){return n.customer===-999}})}]);xpoNlmModule.controller("ApproveCostInstanceController",["$scope","$uibModalInstance","shipmentDetailsService","shipmentDetailsData",function(n,t,i,r){n.AwardedCost=r.shipment.Details.AwardedCost;n.ShipmentId=r.shipment.Details.ShipmentId;n.Accept=function(){i.updateCostApproval(n.ShipmentId,1,n.AwardedCost);t.close(!0)};n.Reject=function(){i.updateCostApproval(n.ShipmentId,0,n.AwardedCost);t.close(!1)};n.Cancel=function(){t.dismiss("cancel")}}]);xpoNlmModule.controller("DocumentUploadModalInstanceController",["$rootScope","$scope","$uibModalInstance","recordId","recordType","documentUploadService","$document",function(n,t,i,r,u,f,e){var h,c,l,a,y,p,w;t.recordId=r;t.recordType=u;t.DocumentTypeRequired=!0;t.showBilling=!1;var b=n.isCustomer||n.customerLocationId>0,k=n.isImpersonatingCarrier||n.isCarrier,d=[".gif",".jpg",".jpeg",".png",".tif",".tiff",".doc",".docx",".msg",".pdf",".xls",".xlsx",".xml"],s=[],v=[],o=[];t.recordType=="Shipment"?h=n.ExpediteApi+"/Documents/?shipmentId="+t.recordId:(h=n.ExpediteApi+"/Documents/BulletinBoard/?messageId="+t.recordId,t.DocumentTypeRequired=!1);var g=n.ExpediteApi+"/Documents/Delete",nt=function(n){n&&$.each(n,function(){var n=this.FileName.slice((this.FileName.lastIndexOf(".")-1>>>0)+1),t=a(n,this.DocumentId);s.push({FileName:this.FileName,FileExtension:n,DocumentType:this.DocumentType,UID:this.DocumentId,SRC:t,IsNew:!1})});t.source.read()},tt=function(n){n?($.each(n,function(){var n=y(this.FileExtension,this.Id);v.push({FileDescription:this.TypeDescription,FileExtension:this.FileExtension,DocumentType:this.DocumentType,Id:this.Id,Data:this.ImageData,ShipmentId:this.ShipmentId,SRC:n})}),t.showBilling=!0):t.showBilling=!1;t.billingSource.read()},it=function(){},rt=function(){};f.getDocuments(h,nt,it);k||t.recordType!="Shipment"||f.getBillingImages(t.recordId,tt,rt);c=function(n){t.DocumentTypes=n;t.seldocType=t.DocumentTypes[0]};l=function(){};b?f.getDocumentTypesByCustomerId(n.customerLocationId,c,l):f.getDocumentTypes(c,l);t.docType_click=function(n,t){t&&(o=o.filter(function(t){return t.FileName!=n.name}),o.push({FileName:n.name,DocumentTypeId:t.DocumentTypeId,DocumentType:t.Type}))};var ut=function(n){return d.indexOf(n.toLowerCase())!==-1?!0:!1},ft=function(n){return n<=16777216?!0:!1},et=function(n){var t=!1,i=o.filter(function(t){return t.FileName==n}),r=s.filter(function(t){return t.FileName==n});return(i.length>0||r.length>0)&&(t=!0),t};t.uploadOptions={"async":{saveUrl:h,removeUrl:g,autoUpload:!1},multiple:!0,template:'<\/span>

Name: #=name# Size: #=size# bytes<\/h4> Read<\/label><\/div>",width:"80px"}]};n.gridDataSource=new kendo.data.DataSource({data:t.UnreadMessages});n.markAsReadClick=function(n){for(let i=0;ii[t]?1:n[t]0&&(n.CustomersService.customers=n.defaultSelect("Customer").concat(n.CustomersService.customers),f(n.CustomersService.customers,"Name"))},u);n.cancel=function(){r.dismiss("cancel")};n.save=function(){n.hasErrors=!0;n.AddUpdateDynamicContentData.CustomerId&&n.AddUpdateDynamicContentData.ContentTitle&&n.AddUpdateDynamicContentData.ContentDetails?(n.hasErrors=!1,n.DynamicContentManagerService.insertDynamicContent(n.AddUpdateDynamicContentData,function(){var n={templateUrl:t.WebClientPath+"/Modules/XpoNlm/Common/Views/MessageModal.html",controller:"MessageModalInstanceController",resolve:{message:function(){return"Content Saved!"},messageType:function(){return"success"}},windowClass:"small-Message-Modal mt-expedite-legacy"};i.open(n);r.close("saved")},u)):n.hasErrors=!0}}()}]);xpoNlmModule.controller("DynamicContentManagerController",["$rootScope","$scope","$uibModal","$routeParams","$document","DynamicContentManagerService",function(n,t,i,r,u,f){"use strict";var e=this,s,o;e.ContentTypeDescription=null;e.selectedContentTypeId=1;t.dynamicContentManagerService=f;t.onSelect=function(n){e.selectedContentTypeId=parseInt(n.item.id);e.ContentTypeDescription=t.dynamicContentManagerService.DynamicContent[0].ContentTypeDescription;t.getDynamicContentList();t.createDataSource();t.grid1.refresh();return};t.onActiveFlagClick=function(r){t.EnableDisableDynamicContentData.ContentId=r.ContentId;t.EnableDisableDynamicContentData.CustomerId=r.CustomerId;t.EnableDisableDynamicContentData.ActiveFlag=r.ActiveFlag;t.dynamicContentManagerService.enableOrDisableDynamicContent(t.EnableDisableDynamicContentData,function(){var u={templateUrl:n.WebClientPath+"/Modules/XpoNlm/Common/Views/MessageModal.html",controller:"MessageModalInstanceController",resolve:{message:function(){return r.ActiveFlag?"Content Enabled!":"Content Disabled"},messageType:function(){return"success"}},windowClass:"small-Message-Modal mt-expedite-legacy"};i.open(u);t.getDynamicContentList();t.createDataSource();t.grid1.refresh()},o)};t.AddUpdateDynamicContentData={ContentTypeId:e.selectedContentTypeId,ContentTypeDescription:e.ContentTypeDescription,CustomerId:null,ContentTitle:null,ContentDetails:null};t.EnableDisableDynamicContentData={ContentTypeId:e.selectedContentTypeId,ContentTypeDescription:e.ContentTypeDescription,ContentId:null,CustomerId:null,ContentTitle:null,ContentDetails:null};t.showAddUpdateDynamicContentModal=function(r){r=="Add"&&(t.AddUpdateDynamicContentData.CustomerId=null,t.AddUpdateDynamicContentData.ContentTitle=null,t.AddUpdateDynamicContentData.ContentDetails=null);t.AddUpdateDynamicContentData.ContentTypeDescription=r+" "+e.ContentTypeDescription;var u={backdrop:"static",controller:"AddDynamicContentModalInstanceController",templateUrl:n.WebClientPath+"/Modules/XpoNlm/DynamicContentManager/Views/AddDynamicContentModal.html",resolve:{AddOrUpdate:function(){return r},AddUpdateDynamicContentData:function(){return t.AddUpdateDynamicContentData}},windowClass:"mt-expedite-legacy"},f=i.open(u);f.result.then(function(){t.getDynamicContentList();t.createDataSource();t.grid1.refresh()},angular.noop)};t.clearErrors=function(){t.errorMessages=[]};s=function(){t.displayResults=!0;t.searchInProgress=!1;e.ContentTypeDescription=t.dynamicContentManagerService.DynamicContent[0].ContentTypeDescription;t.createDataSource()};o=function(t){var r={templateUrl:n.WebClientPath+"/Modules/XpoNlm/Common/Views/MessageModal.html",controller:"MessageModalInstanceController",resolve:{message:function(){return t.ExceptionMessage?t.ExceptionMessage:t.Message?t.Message:typeof t=="string"?t:void 0},messageType:function(){return"error"}},windowClass:"small-Message-Modal mt-expedite-legacy"};i.open(r)};t.UpdateDynamicContentData=function(n){t.AddUpdateDynamicContentData.CustomerId=n.CustomerId;t.AddUpdateDynamicContentData.ContentTitle=n.ContentTitle;t.AddUpdateDynamicContentData.ContentDetails=n.ContentDetails;t.showAddUpdateDynamicContentModal("Update")};t.getDynamicContentList=function(){t.displayResults=!1;t.searchInProgress=!0;t.clearErrors();t.dynamicContentManagerService.getDynamicContent(e.selectedContentTypeId,s,o)};t.GridOptions={columns:[{title:"Active",field:"ActiveFlag",width:"20px",template:'<\/input>'},{field:"CustomerName",title:"Customer",width:"60px"},{field:"ContentTitle",title:"Title",width:"100px"},{field:"ContentDetails",title:"Content",width:"200px"},{field:"LastModifiedByName",title:"Last Modified By",width:"60px"},{field:"LastModifiedByDate",title:"Date",width:"60px",template:"#=(moment(LastModifiedByDate).isValid() ? moment(LastModifiedByDate).format('MM/DD/YYYY') : '')#"},{title:"Action",command:{template:"<\/span>"},width:"20px"}],sortable:!0,reorderable:!0,pageable:!0,scrollable:!0,editable:"inline"};t.createDataSource=function(){t.GridDataSource=new kendo.data.DataSource({data:t.dynamicContentManagerService.DynamicContent,schema:{model:{id:"ContentId",fields:{ContentId:{from:"ContentId",type:"number",editable:!1,nullable:!1},ActiveFlag:{from:"ActiveFlag",type:"boolean",editable:!1},CustomerName:{from:"CustomerName",type:"string",editable:!1},ContentTitle:{from:"ContentTitle",type:"string",editable:!0},ContentDetails:{from:"ContentDetails",type:"string",editable:!0},LastModifiedByName:{from:"LastModifiedByName",type:"string",editable:!1},LastModifiedByDate:{from:"LastModifiedByDate",type:"string",editable:!1}}}},pageSize:25,page:1})};t.getDynamicContentList();angular.element(u).find("html").addClass("carrier-failures");t.$on("$destroy",function(){angular.element(u).find("html").removeClass("carrier-failures")})}]);xpoNlmModule.controller("ColumnManagerModalInstanceController",["$scope","$rootScope","$uibModal","$uibModalInstance","dynamicTrackingService",function(n,t,i,r,u){"use strict";var o={help:{drop:"drop here"}},f=[],s=function(n,t){var i=u.hiddenColumns.splice(n,1)[0];u.displayedColumns.splice(t,0,i)},e=function(n,t){var i=u.displayedColumns.splice(n,1)[0];u.hiddenColumns.splice(t,0,i)},h=function(n,t){var i=u.displayedColumns.splice(n,1)[0];u.displayedColumns.splice(t,0,i)},c=function(n,t){var i=u.hiddenColumns.splice(n,1)[0];u.hiddenColumns.splice(t,0,i)},l=function(n,t){return n.titlet.title?1:0};n.TrackingService=u;u.hiddenColumns.sort(l);n.displayedCount=u.displayedColumns.length;n.totalCount=t.isCustomer||t.customerLocationId>0||t.isImpersonatingCustomer?u.columnSchemaCustomer.length:u.columnSchema.length;n.displayedColumns=u.displayedColumns;n.hiddenColumns=u.hiddenColumns;n.hiddenListChanged=function(n){f.push({list:"hidden",newIndex:n.newIndex,oldIndex:n.oldIndex})};n.displayedListChanged=function(t){f.push({list:"displayed",newIndex:t.newIndex,oldIndex:t.oldIndex});t.oldIndex==-1?n.displayedCount++:t.newIndex==-1&&n.displayedCount--};n.placeholder=function(n){var t=n.clone();return t.addClass("placeholder").text(o.help.drop),t};n.hint=function(n){return n.clone().addClass("hint")};n.Save=function(){var t,i=u.requireExtendedResults;if(n.displayedCount<1){r.dismiss("cancel");return}for(t=0;t20)e(20,0);for(u.requireExtendedResults=!1,t=0;t"")switch(i.searchboxtype.id){case"Ship":case"Proj":n.filterEditMode=!1;break;default:n.filterEditMode=!0}else n.filterEditMode=!0},b=function(n){var e=n.sender,t=e.dataItem(e.select()),u="Yes",f="No",o={templateUrl:l.shipment_summary,link:angular.noop,windowClass:"modal-window-small mt-expedite-legacy"},s=new c(t.OriginName,t.DestinationName,t.AuthorizationCode,t.ReadyTime,t.ProtectTime,t.Critical==!0?u:f,t.Exception==!0?u:f,t.Turnover==!0?u:f,t.Hazmat==!0?u:f,t.DryRun==!0?u:f,t.VoidStatus==1?u:f,t.CreatedBy,t.ShipmentID);h=i.open(o);r.setShipmentDetails(s);h.Close=function(){a};h.result.then(angular.noop,angular.noop)};n.TrackingService=t;n.customerId=r.customerLocationId;n.displayResults=!1;n.displaySearching=!1;n.isAdmin=r.isAdmin||r.isSuperAdmin;n.isCustomer=r.isCustomer||r.customerLocationId>0;n.filterEditMode=!0;n.$watch("TrackingService.selected.preset",y);n.$watch("TrackingService.selected.intransit",p);n.$watch("TrackingService.selected.searchboxtext",w);n.$watch("TrackingService.selected.status",function(i){i&&!n.isCustomer&&(t.selected.status.length==0?(t.selected.dateStart=new Date,t.selected.dateEnd=new Date):t.selected.status.forEach(function(n){n.ID==7?(t.selected.dateStart=new Date,t.selected.dateEnd=new Date):(t.selected.dateStart=null,t.selected.dateEnd=null)}))},!0);n.gridOptions={columns:t.displayedColumns,groupable:!0,pageable:!0,reorderable:!0,selectable:!0,sortable:!0,toolbar:[{template:"
Manage Columns<\/div>"},"excel"],excel:{allPages:!0,fileName:"Dynamic Tracking Data.xlsx",proxyURL:r.ExpediteApi+"/KendoExtensions/Save"},excelExport:function(n){for(var r,i,t,f=n.workbook.sheets[0],u=1;ui.width&&angular.element(t.parent()).addClass("k-fix-ie")},100)}};n.modifyGridColumns=function(){var n=angular.element("#trackingResultsGrid").data("kendoGrid");n.setOptions({columns:t.displayedColumns,columnReorder:function(){t.saveColumnListToPreset()}})};n.loadTrackingSearchResults=function(){var l=[],u,o=[],a=[],f,s={},i=t.selected,y=[],h=null,p=[],w=null,b=null,d=function(){t.presetChanged&&(t.selected.preset.displayedColumns&&(t.setColumns(t.selected.preset.displayedColumns),n.modifyGridColumns()),t.presetChanged=!1);n.searchResultsCount=t.searchResults.length;n.gridDataSource=new kendo.data.DataSource({data:t.searchResults,schema:{model:{fields:t.searchResultsSchema}},pageSize:n.isAdmin&&!n.isCustomer?20:100});n.displaySearching=!1;n.displayResults=!0},g=function(t,i){var u,r;if(n.displayError=!0,n.displayResults=!1,n.displaySearching=!1,n.searchErrors=[],i===400)for(r=0;r""){var k=/^([\d]*)$/,c=/^([A-z\d]*)$/,e="";switch(i.searchboxtype.id){case"Proj":f="ProjectId";k.test(i.searchboxtext)||(e="This is not a valid Project ID. Please check the Project ID provided is correct and try again.");break;case"Auth":f="AuthorizationCode";break;case"BOL":f="BOL";(i.searchboxtext.toLowerCase().startsWith("unknow")||!c.test(i.searchboxtext))&&(e="This is not a valid BOL. Please check the BOL provided is correct and try again.");break;case"Pedimento":f="PedimentoNumber";break;case"WO":f="WorkOrder";c.test(i.searchboxtext)||(e="This is not a valid Work Order #. Please check the Work Order # provided is correct and try again.");break;case"GL":f="GL";c.test(i.searchboxtext)||(e="This is not a valid GL #. Please check the GL # provided is correct and try again.");break;case"PO":f="PO";c.test(i.searchboxtext)||(e="This is not a valid PO #. Please check the PO # provided is correct and try again.");break;case"WBS":f="WBS";break;default:f="ShipmentId";k.test(i.searchboxtext)||(e="This is not a valid Shipment #. Please check the Shipment # provided is correct and try again.")}if(i.searchboxtext.match(",")!==","&&e.length===0)s[f]=i.searchboxtext;else{n.displayError=!0;n.searchErrors=!0;n.displayResults=!1;n.displaySearching=!1;n.searchErrors=[];n.searchErrors.push(e);return}}else{for(u=0;u0&&(r.shipmentAudit.mostRecentGpsPosition=n[0])},angular.noop)};r.Close=function(){h&&h.dismiss("cancel")};n.gridColumnReorder=function(n){var i=t.displayedColumns.splice(n.oldIndex,1)[0];t.displayedColumns.splice(n.newIndex,0,i)};n.gridChange=b;n.isCustomer&&(n.gridChange=angular.noop,n.loadTrackingSearchResults());n.openDocUploadModal=function(n){i.open({templateUrl:r.WebClientPath+"/Modules/XpoNlm/Common/Views/DocumentUploadModal.html",controller:"DocumentUploadModalInstanceController",resolve:{recordId:function(){return n},recordType:function(){return"Shipment"}},windowClass:"modal-window-large mt-expedite-legacy",backdrop:"static",keyboard:!1})};n.viewCustomerShipmentDetails=function(n){var t;t="/WebClient/ShipmentDetails/#/ShipmentDetails/"+n;u.open(t,"details","width=800px,height=700px,scrollbars=yes,toolbar=0,menubar=1,resizable=1")};angular.element(e).find("html").addClass("dynamic-tracking");n.$on("$destroy",function(){angular.element(e).find("html").removeClass("dynamic-tracking")})}]);xpoNlmModule.controller("PresetManagerModalInstanceController",["$scope","$rootScope","$uibModal","$uibModalInstance","$filter","dynamicTrackingService",function(n,t,i,r,u,f){"use strict";n.isAdmin=(t.isAdmin||t.isSuperAdmin)&&!t.isImpersonatingCarrier&&!t.isImpersonatingCustomer;n.isCustomer=t.isCustomer||t.customerLocationId>0||t.isImpersonatingCustomer;var o=f,e={},h=function(n){e.selectedintransitmanager=n},c=function(){n.selectedpreset.id==0?r.close(n.selectedpreset):r.dismiss("cancel")},s=function(t){t&&t.id&&(n.selectedpreset=u("filter")(n.presets,{id:t.id})[0],e.selectedbilltomanager=angular.copy(n.selectedpreset.billto),e.selectedcallermanager=angular.copy(n.selectedpreset.caller),e.selectedcarriermanager=angular.copy(n.selectedpreset.carrier),e.selectedconsigneemanager=angular.copy(n.selectedpreset.consignee),e.selectedcustomersmanager=angular.copy(n.selectedpreset.customers),e.selectedfinalconsigneemanager=angular.copy(n.selectedpreset.finalconsignee),e.selectedintransitmanager=n.selectedpreset.intransit?angular.copy(e.transitstatuses[0]):angular.copy(e.transitstatuses[1]),e.selectedmodegroupsmanager=angular.copy(n.selectedpreset.modegroups),e.selectedmodetypesmanager=angular.copy(n.selectedpreset.modetypes),e.selectedoriginalshippermanager=angular.copy(n.selectedpreset.originalshipper),e.selectedshippermanager=angular.copy(n.selectedpreset.shipper),e.selectedstatusmanager=angular.copy(n.selectedpreset.status),e.selectedwarningsmanager=angular.copy(n.selectedpreset.warnings))},l=function(t){var i=function(){},u;n.presets.splice(t,1);n.presets.length<2?(o.deleteUserFilterPreset(angular.noop,i),o.userPerferenceId=null):(u={UserPreferenceId:o.userPerferenceId,UserFilters:n.presets.filter(function(n){return n.id>0})},o.saveFilterPreset(u,angular.noop,i));n.selectedpreset=_.last(n.presets);s(n.selectedpreset);o.selected.preset=n.selectedpreset;n.presets.length<2&&(r.close(n.selectedpreset),e.selectedbilltormanager=[],e.selectedcallermanager=[],e.selectedcarriermanager=[],e.selectedconsigneemanager=[],e.selectedcustomersmanager=[],e.selectedfinalconsigneemanager=[],e.selectedintransitmanager={},e.selectedmodegroupsmanager=[],e.selectedmodetypesmanager=[],e.selectedoriginalshippermanager=[],e.selectedshippermanager=[],e.selectedstatusmanager=[],e.selectedwarningsmanager=[])},a=function(){var i=function(){},t;(r.close(n.selectedpreset),n.selectedpreset.id)&&(n.selectedpreset.carrier=e.selectedcarriermanager,n.selectedpreset.customers=e.selectedcustomersmanager,n.selectedpreset.modegroups=e.selectedmodegroupsmanager,n.selectedpreset.modetypes=e.selectedmodetypesmanager,n.selectedpreset.status=e.selectedstatusmanager,n.selectedpreset.warnings=e.selectedwarningsmanager,o.selected.carrier=e.selectedcarriermanager,o.selected.customers=e.selectedcustomersmanager,o.selected.modegroups=e.selectedmodegroupsmanager,o.selected.modetypes=e.selectedmodetypesmanager,o.selected.status=e.selectedstatusmanager,o.selected.warnings=e.selectedwarningsmanager,n.selectedpreset.caller=e.selectedcallermanager,n.selectedpreset.consignee=e.selectedconsigneemanager,n.selectedpreset.finalconsignee=e.selectedfinalconsigneemanager,n.selectedpreset.intransit=e.selectedintransitmanager.Value,n.selectedpreset.originalshipper=e.selectedoriginalshippermanager,n.selectedpreset.shipper=e.selectedshippermanager,n.selectedpreset.billto=e.selectedbilltomanager,o.selected.caller=e.selectedcallermanager,o.selected.consignee=e.selectedconsigneemanager,o.selected.finalconsignee=e.selectedfinalconsigneemanager,o.selected.intransit=e.selectedintransitmanager.Value,o.selected.originalshipper=e.selectedoriginalshippermanager,o.selected.shipper=e.selectedshippermanager,o.selected.billto=e.selectedbilltomanager,t={UserPreferenceId:o.userPerferenceId,UserFilters:n.presets.filter(function(t){return t.id>0&&t.id!=!n.selectedpreset.id})},o.saveFilterPreset(t,angular.noop,i))},v=function(n){return n};n.input=e;n.presets=o.presets;n.selectedpreset=o.selected.preset;e.customers=o.customers;e.modeGroups=o.modeGroups;e.modeTypes=o.modeTypes;e.statuses=o.statuses;e.transitstatuses=o.transitstatuses;e.warnings=o.warnings;n.MultiSelectCustomersDefaultText={buttonDefaultText:"Customers"};n.MultiSelectWarningsDefaultText={buttonDefaultText:"Warnings"};n.MultiSelectModeGroupsDefaultText={buttonDefaultText:"Mode Groups"};n.MultiSelectModeTypesDefaultText={buttonDefaultText:"Mode Types"};n.MultiSelectInTransitDefaultText={buttonDefaultText:"Select"};n.settings={scrollable:!0,scrollableHeight:"200px",showCheckAll:!1,showUncheckAll:!1,smartButtonTextConverter:v};n.selectedpreset.id==0&&(n.selectedpreset=o.presets[1]);n.Cancel=c;n.Delete=l;n.selectPreset=s;n.Update=a;n.transitstatus_click=h;n.selectPreset(n.selectedpreset)}]);xpoNlmModule.controller("PresetSaveAsModalInstanceController",["$scope","$uibModal","$uibModalInstance","dynamicTrackingService",function(n,t,i,r){"use strict";var u={errors:{saveAs:"That filter name already exists, please enter a unique name."}},f=function(){var s=[],f,e=1,h=n.input.presetName,t,o={caller:r.selected.caller,carrier:r.selected.carrier,consignee:r.selected.consignee,customers:r.selected.customers,billto:r.selected.billto,displayedColumns:s,finalconsignee:r.selected.finalconsignee,id:e.toString(),intransit:r.selected.intransit,modegroups:r.selected.modegroups,modetypes:r.selected.modetypes,name:h,originalshipper:r.selected.originalshipper,shipper:r.selected.shipper,status:r.selected.status,warnings:r.selected.warnings},l=function(){},c;for(n.displayErrorSaveAs=!1,t=0;t=e&&(e=parseInt(r.presets[t].id)+1)}for(f=0;f0})};r.saveFilterPreset(c,angular.noop,l);i.close(o)};n.input={};n.Save=f;n.Cancel=function(){i.dismiss("cancel")}}]);xpoNlmModule.controller("InvoiceDisputeItemManagerController",["$scope","$rootScope","$routeParams","payAndInvoiceService","$window",function(n,t,i,r,u){function o(n,t){$('').appendTo(n).kendoNumericTextBox({spinners:!1})}var e,f;n.errors="";n.ShipmentId=i.shipmentId;n.CarrierDisputeId=i.carrierDisputeId;n.UserId=i.UserId;n.InvoiceDstId=i.InvoiceDstId;n.ItemCost="";n.exceptionShipmentFlag=!1;n.InsertUpdateModel=new Object(Id=null,CarrierDisputeId=null,InvoiceItemTypeId=null,InvoiceItemTypeDescription="",UnitPrice=null,Quantity=null,ItemCost=null,StaffId=null);e=function(t){n.errors=t};f=new kendo.data.DataSource({transport:{read:function(t){r.getInvoiceDisputeItems(n.CarrierDisputeId).then(function({data:i}){t.success(i);i.length!==0&&(n.InsertUpdateModel=i[0]);n.errors=[]},function({data:n}){t.error(n)})},update:function(t){t.data.Editable?(n.InsertUpdateModel.Id=t.data.Id,n.InsertUpdateModel.UnitPrice=t.data.Cost,n.InsertUpdateModel.Quantity=1,r.updateInvoiceDisputeItem(t.data.Id,n.InsertUpdateModel,e).then(function({data:i}){t.success(i);n.errors=[];n.refreshInvoicePage()},function({data:i}){t.error(i);n.errors=i.Error})):(n.errors="This invoice item has already been resolved",t.error(n.errors));n.$apply()},destroy:function(t){t.data.Editable?r.deleteInvoiceDisputeItem(t.data.Id,e).then(function({data:i}){t.success(i);n.errors=[];n.refreshInvoicePage()},function({data:i}){t.error(i);n.errors=i.Error}):(n.errors="This invoice item has already been resolved",t.error(n.errors));n.$apply()}},schema:{model:{id:"Id",fields:{InvoiceItemTypeDescription:{editable:!1},Cost:{editable:!0,type:"number",validation:{required:!0}},Editable:{editable:!1},Id:{editable:!1}}}},aggregate:[{field:"Cost",aggregate:"sum"}]});n.gridOptions={dataSource:f,columns:[{field:"InvoiceItemTypeDescription",title:"Item Type",attributes:{style:"text-align: left"},headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"Cost",title:"Cost",width:"130px",format:"{0:c}",template:"#= (Cost >= 0)?kendo.toString(Cost, 'C') : '-' + kendo.toString(Cost, 'C') #<\/span>",footerTemplate:"
Total: #= kendo.toString(sum, 'C')#<\/div>",headerAttributes:{style:"white-space: normal; font-weight: bold; text-align:left"},editor:o},{command:["edit","destroy"],title:"Options",width:"180px",headerAttributes:{style:"font-weight: bold;"},hidden:t.isCarrier||t.isImpersonatingCarrier}],scrollable:!1,editable:"inline",edit:function(){n.errors=[]},cancel:function(){n.errors=[]}};n.selectAccessorial=function(t){n.selectedAccessorial=t};r.getAccessorialList().then(function({data:t}){n.Accessorials=t;_.prepend(n.Accessorials,{InvoiceItemTypeId:-1,AccessorialRateTypeName:"--- Please Select ---"});n.selectedAccessorial=_.first(n.Accessorials)});n.insertInvoiceDisputeItem=function(t){n.InvoiceIsResolved()?n.errors="This invoice item has already been resolved":isNaN(t)||t.trim().length===0?n.errors="Cost must be a numeric value":(n.InsertUpdateModel.Id=null,n.InsertUpdateModel.CarrierDisputeId=n.CarrierDisputeId,n.InsertUpdateModel.InvoiceItemTypeId=n.selectedAccessorial.InvoiceItemTypeId,n.InsertUpdateModel.InvoiceItemTypeDescription="",n.InsertUpdateModel.UnitPrice=t,n.InsertUpdateModel.Quantity=1,n.InsertUpdateModel.Cost=t,n.InsertUpdateModel.StaffId=n.UserId,r.insertInvoiceDisputeItem(n.CarrierDisputeId,n.InsertUpdateModel).then(function(){f.read();n.errors=[];n.refreshInvoicePage()},function({data:t}){n.errors=t.Error}))};n.InvoiceIsResolved=function(){return n.InvoiceDstId==="0"||n.InvoiceDstId==="3"||n.InvoiceDstId==="5"?!0:!1};n.refreshInvoicePage=function(){var n=u.opener;n&&!n.closed&&n.location.reload()};n.InsertInvoiceItem=function(t,i){n.InvoiceIsResolved()?n.errors="This invoice item has already been resolved":r.insertInvoiceDisputeItem(t,i).then(function(){f.read();n.errors=[];n.refreshInvoicePage()},function({data:t}){n.errors=t.Error})};n.UpdateInvoiceItem=function(t,i){r.updateInvoiceDisputeItem(t,i,e).then(function(){f.read();n.errors=[];n.refreshInvoicePage()},function({data:t}){n.errors=t.Error})};n.AdditionalMiles=0;n.OriginalFSC=0;n.AdditionalFSC=0;n.TotalFSC=0;n.CalculateFuelSurcharge=function(t){if(isNaN(t)||t<=0){n.errors="Additional Miles must be a numeric value and be greater than 0";return}r.getAdditionalFuelSurcharge(n.ShipmentId,t).then(function({data:t}){n.OriginalFuelSurcharge=t.OriginalFuelSurcharge;n.AdditionalFuelSurcharge=t.AdditionalFuelSurcharge;n.TotalFSC=t.NewFuelSurcharge;n.errors=[]},function({data:t}){n.errors=t.Message})};n.AddUpdateFSC=function(){var t=_.find(n.grid.dataSource._data,function(n){return n.InvoiceItemTypeId===31?n:null});t==null?(n.InsertUpdateModel.Id=null,n.InsertUpdateModel.CarrierDisputeId=n.CarrierDisputeId,n.InsertUpdateModel.InvoiceItemTypeId=31,n.InsertUpdateModel.InvoiceItemTypeDescription="",n.InsertUpdateModel.UnitPrice=n.TotalFSC,n.InsertUpdateModel.Quantity=1,n.InsertUpdateModel.Cost=n.TotalFSC,n.InsertUpdateModel.StaffId=n.UserId,n.InsertInvoiceItem(n.CarrierDisputeId,n.InsertUpdateModel)):(n.InsertUpdateModel.Id=t.Id,n.InsertUpdateModel.UnitPrice=n.TotalFSC,n.InsertUpdateModel.Quantity=1,n.UpdateInvoiceItem(t.Id,n.InsertUpdateModel))};r.GetWeightBreakdownList().then(function({data:t}){n.WeightBreakdowns=t;_.prepend(n.WeightBreakdowns,{Id:-1,Description:"Use Existing"});n.selectedWeightBreakdown=_.first(n.WeightBreakdowns)});r.GetRateCalculatorData(n.ShipmentId).then(function({data:t}){n.RateCalculatorData=t;r.GetMileageBreakdownList(n.RateCalculatorData.ParentCustomerId).then(function({data:t}){n.MileageBreakdowns=t;_.prepend(n.MileageBreakdowns,{Id:-1,Description:"Use Existing"});n.selectedMileageBreakdown=_.first(n.MileageBreakdowns)})});n.CalculateRate=function(){n.ModeSelectorProxyParametersViewModel={ShipmentId:parseInt(n.ShipmentId),CustomerId:n.RateCalculatorData.CustomerId,CarrierId:n.RateCalculatorData.CarrierId,Mileage:n.selectedMileageBreakdown.Id,Weight:n.selectedWeightBreakdown.Id};r.GetRate(n.ModeSelectorProxyParametersViewModel).then(function({data:t}){n.ComputedRate=t[0].NewCost})};n.selectWeightBreakdown=function(t){n.selectedWeightBreakdown=t};n.selectMileageBreakdown=function(t){n.selectedMileageBreakdown=t};n.DetentionData;r.GetDetentionCalculationData(n.ShipmentId).then(function({data:t}){n.DetentionData=t;n.exceptionShipmentFlag=t[0].ExceptionFlag;n.errors=[]},function({data:t}){n.errors=t.Message});n.AddUpdateDetention=function(){var o=_.filter(n.DetentionData,function(n){return n.StopType==="Pickup"}),u=_.sumBy(o,"DetentionAmount"),f,i,e,r,t;u>0&&(t=_.find(n.grid.dataSource._data,function(n){return n.InvoiceItemTypeId===18?n:null}),t==null?(n.InsertUpdateModel.Id=null,n.InsertUpdateModel.CarrierDisputeId=n.CarrierDisputeId,n.InsertUpdateModel.InvoiceItemTypeId=18,n.InsertUpdateModel.InvoiceItemTypeDescription="",n.InsertUpdateModel.UnitPrice=u,n.InsertUpdateModel.Quantity=1,n.InsertUpdateModel.Cost=u,n.InsertUpdateModel.StaffId=n.UserId,n.InsertInvoiceItem(n.CarrierDisputeId,angular.copy(n.InsertUpdateModel))):(n.InsertUpdateModel.Id=t.Id,n.InsertUpdateModel.UnitPrice=u,n.InsertUpdateModel.Quantity=1,n.UpdateInvoiceItem(t.Id,angular.copy(n.InsertUpdateModel))));f=_.filter(n.DetentionData,function(n){return n.StopType==="MEX Border"});i=_.sumBy(f,"DetentionAmount");i>0&&(t=_.find(n.grid.dataSource._data,function(n){return n.InvoiceItemTypeId===9999?n:null}),t==null?(n.InsertUpdateModel.Id=null,n.InsertUpdateModel.CarrierDisputeId=n.CarrierDisputeId,n.InsertUpdateModel.InvoiceItemTypeId=99999,n.InsertUpdateModel.InvoiceItemTypeDescription="",n.InsertUpdateModel.UnitPrice=i,n.InsertUpdateModel.Quantity=1,n.InsertUpdateModel.Cost=i,n.InsertUpdateModel.StaffId=n.UserId,n.InsertInvoiceItem(n.CarrierDisputeId,angular.copy(n.InsertUpdateModel))):(n.InsertUpdateModel.Id=t.Id,n.InsertUpdateModel.UnitPrice=i,n.InsertUpdateModel.Quantity=1,n.UpdateInvoiceItem(t.Id,angular.copy(n.InsertUpdateModel))));e=_.filter(n.DetentionData,function(n){return n.StopType==="Delivery"});r=_.sumBy(e,"DetentionAmount");r>0&&(t=_.find(n.grid.dataSource._data,function(n){return n.InvoiceItemTypeId===19?n:null}),t==null?(n.InsertUpdateModel.Id=null,n.InsertUpdateModel.CarrierDisputeId=n.CarrierDisputeId,n.InsertUpdateModel.InvoiceItemTypeId=19,n.InsertUpdateModel.InvoiceItemTypeDescription="",n.InsertUpdateModel.UnitPrice=r,n.InsertUpdateModel.Quantity=1,n.InsertUpdateModel.Cost=r,n.InsertUpdateModel.StaffId=n.UserId,n.InsertInvoiceItem(n.CarrierDisputeId,angular.copy(n.InsertUpdateModel))):(n.InsertUpdateModel.Id=t.Id,n.InsertUpdateModel.UnitPrice=r,n.InsertUpdateModel.Quantity=1,n.UpdateInvoiceItem(t.Id,angular.copy(n.InsertUpdateModel))))};u.onbeforeunload=function(){n.refreshInvoicePage()}}]);xpoNlmModule.controller("SpecializedReleasePOLegacyPickerController",["$scope","$routeParams","specializedService",function(n,t,i){n.releasePOsGridOptions={columns:[{field:"ReleaseNumber",title:"Release Number",width:"70px",filterable:!1},{field:"ReleaseAmount",title:"Release PO Amount",format:"{0:c2}",width:"60px",filterable:!1},{field:"ReleaseSpent",title:"Release PO Spent",format:"{0:c2}",width:"60px",filterable:!1},{field:"ReleaseBalance",title:"Release PO Balance",format:"{0:c2}",width:"60px",filterable:!1},{field:"IsClosed",title:"Closed",width:"23px",filterable:!1,template:"#=IsClosed ? 'Yes' : 'No' #"},{field:"ClosedDate",title:"Closed Date",width:"30px",filterable:!1,template:"#=(moment(ClosedDate).isValid() ? moment(ClosedDate).format('YYYY-MM-DD') : '')#"}],sortable:!0,reorderable:!0,groupable:!1,columnMenu:!1,selectable:!0,scrollable:!0,height:300};n.search=function(){var r={releaseNumber:n.releaseNumberQuery,customerId:t.customerId,includeClosed:!0};n.searchInProgress=!0;i.getReleasePOs(r).then(function({data:i}){n.releasePOsGridDataSource=new kendo.data.DataSource({data:_.filter(i,function(n){return t.shipmentCost?n.ReleaseBalance>=t.shipmentCost:!0}),cache:!1});n.searchInProgress=!1},function(){n.searchInProgress=!1})};n.search();n.releasePOsGridChange=function(t){var i=t.sender,r=i.dataItem(i.select());n.releasePO=r};n.cancel=function(){window.close()};n.selectReleasePO=function(){if(n.releasePO)if(n.releasePO.IsClosed)n.errors=["Closed Releases cannot be selected."];else{var t=window.opener;t&&!t.closed&&t.UpdateSpecializedReleaseNumber(n.releasePO.ReleasePoId,n.releasePO.ReleaseNumber);window.close()}else alert("You must first select a Release PO record.")}}]);xpoNlmModule.controller("SpecializedTaskLegacyPickerController",["$scope","specializedService",function(n,t){n.tasksGridOptions={columns:[{field:"ProjectName",title:"Project",filterable:!1},{field:"TaskName",title:"Task",filterable:!1}],sortable:!0,reorderable:!0,groupable:!1,columnMenu:!1,selectable:!0,scrollable:!0,height:460};n.search=function(){var i={};n.taskNameQuery&&(i.taskName=n.taskNameQuery);n.projectNameQuery&&(i.projectName=n.projectNameQuery);n.searchInProgress=!0;t.getSpecializedTasks(i).then(function({data:t}){n.tasksGridDataSource=new kendo.data.DataSource({data:t,cache:!1});n.searchInProgress=!1},function(){n.searchInProgress=!1})};n.search();n.tasksGridGridChange=function(t){var i=t.sender,r=i.dataItem(i.select());n.task=r};n.cancel=function(){window.close()};n.selectTask=function(){if(n.task){var t=window.opener;t&&!t.closed&&t.UpdateSpecializedTaskAndProject(n.task.TaskId,n.task.TaskName,n.task.ProjectName);window.close()}else alert("You must first select a Task record.")}}]);xpoNlmModule.controller("LocationGroupManagerController",["$scope","locationGroupService",function(n,t){function u(t,i){angular.element('').appendTo(t).kendoDropDownList({autoBind:!1,height:1e3,dataSource:{transport:{read:function(t){t.success(_.map(n.CustomerList,"Name"))}}}})}function f(t,i){angular.element('').appendTo(t).kendoDropDownList({autoBind:!1,height:1e3,dataSource:{transport:{read:function(t){t.success(_.map(n.locationSubGroups,"Name"))}}}})}var r,i;n.errors="";n.mainGridEnabledOnly=!0;n.detailGridEnabledOnly=!0;n.LocationGroupModel=[];n.selectedLocationGroupId=0;t.getLocationSubGroups().then(function({data:t}){n.locationSubGroups=t});t.getCustomerList().then(function({data:t}){n.CustomerList=t.filter(n=>n.Status!==0)});r=new kendo.data.DataSource({transport:{read:function(i){t.getLocationGroups().then(function({data:t}){n.LocationGroupModel=t[0];i.success(t);n.errors=[]},function({data:t}){i.error(t);n.errors=t})},update:function(i){var f=_.find(n.CustomerList,{Name:i.data.CustomerName}),u;f!=null&&(i.data.CustomerId=f.Id);u=_.find(n.locationSubGroups,{Name:i.data.SubGroupName});u!=null&&(i.data.SubGroupId=u.Id,i.data.SubGroupDescription=u.Description);t.UpdateLocationGroup(i.data.Id,i.data).then(function({data:t}){i.success(t);r.read();n.errors=[]},function({data:t}){i.error(t);n.errors=t});n.$apply()},create:function(i){var f=_.find(n.CustomerList,{Name:i.data.CustomerName}),u;f!=null&&(i.data.CustomerId=f.Id);u=_.find(n.locationSubGroups,{Name:i.data.SubGroupName});u!=null&&(i.data.SubGroupId=u.Id,i.data.SubGroupDescription=u.Description);t.InsertLocationGroup(i.data).then(function({data:t}){i.success(t);r.read();n.errors=[]},function({data:t}){i.error(t);n.errors=t});n.$apply()}},schema:{model:{id:"Id",fields:{Id:{editable:!1},SubGroupId:{editable:!1,nullable:!0,defaultValue:1},SubGroupName:{defaultValue:""},SubGroupDescription:{editable:!1,defaultValue:""},CustomerId:{editable:!1,nullable:!0,defaultValue:1},CustomerName:{editable:!0,defaultValue:""},Name:{validation:{required:!0},defaultValue:""},Description:{validation:{required:!0},defaultValue:""},Notes:{editable:!0,defaultValue:""},Enabled:{type:"boolean",defaultValue:!0},LastUpdatedByName:{editable:!1,defaultValue:""}}}},pageSize:10,filter:{field:"Enabled",operator:"eq",value:!0}});n.mainGridOptions={dataSource:r,sortable:!0,selectable:!0,filterable:!0,pageable:!0,scrollable:!1,groupable:!0,toolbar:["create"],columns:[{field:"Name",title:"Name",width:"120px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"Description",title:"Description",width:"400px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"Notes",title:"Notes",width:"300px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"CustomerName",title:"Customer",editor:u,width:"180px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"SubGroupName",title:"Sub Group Name",editor:f,width:"140px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"SubGroupDescription",title:"Sub Group Description",width:"300px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"Enabled",title:"Enabled",template:"",width:"50px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"LastUpdatedByName",title:"User",width:"130px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{command:["edit"],title:"Options",width:"180px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}}],editable:"inline"};n.LocationGroupSelected=function(t){var r=t.sender,u=r.dataItem(r.select());n.selectedLocationGroupId=u.Id;i.read()};i=new kendo.data.DataSource({transport:{read:function(i){t.getLocationGroupMembers(n.selectedLocationGroupId).then(function({data:t}){i.success(t);n.errors=[]},function({data:t}){i.error(t);n.errors=t})},create:function(n){n.success()},update:function(i){t.updateLocationGroupMember(i.data.Id,i.data.Enabled).then(function({data:t}){i.success(t);n.errors=[]},function({data:t}){i.error(t);n.errors=t})}},schema:{model:{id:"Id",fields:{Id:{editable:!1},LocationGroupId:{editable:!1},LocationId:{editable:!1,nullable:!0},LocationName:{editable:!1},LocationAddress:{editable:!1},DateEnabled:{editable:!1},Enabled:{type:"boolean",defaultValue:!0}}}},filter:{field:"Enabled",operator:"eq",value:!0}});n.detailGridOptions={dataSource:i,scrollable:!0,sortable:!0,filterable:!0,columns:[{field:"LocationId",title:"Location Id",width:"100px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"LocationName",title:"Name",width:"200px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"LocationAddress",title:"Address",width:"200px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"DateEnabled",title:"Date Enabled",width:"140px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{field:"Enabled",title:"Enabled",template:"",width:"110px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}},{command:["edit"],title:"Options",width:"200px",headerAttributes:{style:"white-space: normal; font-weight: bold;"}}],editable:"inline"};n.AddLocation=function(r){t.insertLocationGroupMember(r,n.selectedLocationGroupId).then(function(){i.read();n.$broadcast("onClear");n.errors=[]},function({data:t}){n.errors=t})};n.AddCarrier=function(r){t.insertLocationGroupMember(r,n.selectedLocationGroupId).then(function(){i.read();n.$broadcast("onClear");n.errors=[]},function({data:t}){n.errors=t})}}]);xpoNlmModule.controller("googleMaps.Controller",["$window","$scope",function(n,t){function e(n){if(!n)return undefined;try{const r=n.substring(0,3),u=n.substring(3,5),f=n.substring(5,7),i=n.substring(7);let t=Number(r)+Number(u)/60+Number(f)/3600;return(i==="S"||i==="W")&&(t=t*-1),t}catch(t){return console.error(t),undefined}}function o(n){var o=t.shipmentStops[n],f=new google.maps.LatLng(e(o.LocationLatitude),e(o.LocationLongitude)),s="https://maps.google.com/mapfiles/ms/icons/green-dot.png",i,h;n==0&&(t.originLatLng=f);n==t.shipmentStops.length-1&&(t.destinationLatLng=f,s="https://maps.google.com/mapfiles/ms/icons/red-dot.png");i=new google.maps.Marker({map:r,position:f,icon:s});u.extend(i.getPosition());contentString='
<\/div>
'+t.shipmentStops[n].LocationName+'<\/h5>
'+t.shipmentStops[n].LocationAddress+", "+t.shipmentStops[n].LocationCity+", "+t.shipmentStops[n].LocationState+"<\/div><\/div>";h=new google.maps.InfoWindow({content:contentString});i.addListener("click",function(){h.open(r,i)});n==t.shipmentStops.length-1&&t.drawMap()}if(typeof google=="undefined"){console.log("Google Maps API isn't loaded—bailing out.");return}var r=null,u=null,f=null;t.defaultLocation=new google.maps.LatLng(42.5011942,-83.2829078);t.mapLoaded=!1;t.directionsService=new google.maps.DirectionsService;t.originLatLng=null;t.destinationLatLng=null;t.GPSWayPoints=[];t.zoom=5;t.initMapPtr=function(){t.control.registerMapScope(t)};t.initVariables=function(){t.defaultLocation=new google.maps.LatLng(42.5011942,-83.2829078);t.mapLoaded=!1;u=new google.maps.LatLngBounds(null,null);t.GPSWayPoints=[]};t.initMap=function(){t.initVariables();u=new google.maps.LatLngBounds;var e={center:t.defaultLocation,zoom:10};for(f=n.document.getElementById("map-canvas"),r=new google.maps.Map(f,e),i=0;i0){i=null;f=null;t.shipmentStops[0].ATA!=null&&(i=new Date(t.shipmentStops[0].ATA));t.shipmentStops[t.shipmentStops.length-1].ATA!=null&&(f=new Date(t.shipmentStops[t.shipmentStops.length-1].ATA));var e=0,o=t.gpsView.length-1,a=1,s=null;for(n=0;n<=t.gpsView.length-1;n++)i!=null&&(s=new Date(t.gpsView[n].UpdateTime),e=n,s>=i&&(n=t.gpsView.length-1));for(n=0;n<=t.gpsView.length-1;n++)f!=null&&(s=new Date(t.gpsView[n].UpdateTime),o=n,s>=f&&(shipmentAtDestination=!0,n=t.gpsView.length-1));for(o-e>23&&(a=Math.ceil((e-o)/23)),h=null,n=e;n<=o;n++)c=null,l=null,n%a==0&&(c=t.gpsView[n].Longitude,l=t.gpsView[n].Latitude,h=new google.maps.LatLng(l,c),t.GPSWayPoints.push({location:h,stopover:!0}));t.GPSWayPoints.length>0&&(t.destinationLatLng=h)}v={origin:t.originLatLng,destination:t.destinationLatLng,waypoints:t.GPSWayPoints,travelMode:google.maps.DirectionsTravelMode.DRIVING};t.gpsView.length>0&&t.directionsService.route(v,function(n,t){if(t==google.maps.DirectionsStatus.OK){var i=n.routes[0].overview_polyline,u=google.maps.geometry.encoding.decodePath(i),f=new google.maps.Polyline({strokeColor:"blue",strokeOpacity:1,strokeWeight:2,path:u,clickable:!1});f.setMap(r)}else alert("failed to get directions")});t.mapLoaded=!0;u!=null&&(r.fitBounds(u),r.panToBounds(u));window.setTimeout(function(){google.maps.event.trigger(r,"resize");r.fitBounds(u)},100)}catch(y){console.log(y);t.mapLoaded=!1}}}]);xpoNlmModule.controller("xpoMapGrid.Controller",["$window","$scope","$routeParams","$http","$location","Enum","$rootScope",function(n,t,i,r,u,f){t.mapPtr=t.mappingController=null;t.selected=null;t.Enum=f;t.markerCollection=[];t.getGps=function(){return t.gps};t.setMapCenter=function(n,i){var r=new google.maps.LatLng(parseFloat(n),parseFloat(i)),u=new google.maps.Marker({position:r,map:t.map,title:"Uluru (Ayers Rock)"});t.markerCollection.push(u);t.map.setCenter(r);t.map.setZoom(12)};t.hasGPS=function(){return t.gps==null||t.gps==undefined||t.gps.length==0?!1:!0};t.setMode=function(n){t.PageMode=n==null?t.PageMode==f.ControlMode.ReadOnly?f.ControlMode.Edit:f.ControlMode.ReadOnly:n};t.setSelected=function(n){t.selected=n};t.isSelected=function(n){return t.selected===n};t.message=function(n){for(var r,i=0;i0;){i=n.shift();t=t+3200*r;switch(i){case"/WebClient/Content/media/NewAwards.mp3":s(function(){h.document.getElementById("legacyNotification_NewAwards").play()},t);break;case"/WebClient/Content/media/NewShipments.mp3":s(function(){h.document.getElementById("legacyNotification_NewShipments").play()},t);break;case"/WebClient/Content/media/awardedprojects.mp3":s(function(){h.document.getElementById("legacyNotification_AwardedProjects").play()},t);break;case"/WebClient/Content/media/newprojects.mp3":s(function(){h.document.getElementById("legacyNotification_NewProjects").play()},t);break;case"/WebClient/Content/media/NewCheckCall.mp3":s(function(){h.document.getElementById("legacyNotification_NewCheckCall").play()},t)}r++}}o.audioQueue=[];o.isAdmin=u.isAdmin;o.isCarrier=u.isCarrier;o.isCustomer=u.isCustomer;o.isImpersonatingCarrier=u.isImpersonatingCarrier;o.isImpersonatingCustomer=u.isImpersonatingCustomer;o.isITStaff=u.isITStaff;o.isLoggedIn=u.isLoggedIn;o.isSuperAdmin=u.isSuperAdmin;o.logincontrolhtml=null;o.menus=null;o.canChangeLanguage=u.canChangeLanguage;o.regionName=u.regionName;o.languageList=u.languageList;o.navSvc=c;o.notSvc=l;o.redirectService=p;angular.element(h).bind("resize",function(){o.initializeWindowSize();o.$$phase||o.$apply()});o.initializeWindowSize=function(){o.windowHeight=h.innerHeight;o.windowWidth=h.innerWidth};o.updateNotifications=function(){o.notSvc.getNotifications(function(){o.notSvc.notificationData.AudibleNotifications=$.grep(o.notSvc.notificationData.Notifications,function(n){return n.Type==1||n.Type==2||n.Type==3||n.Type==4||n.Type==5||n.Type==6});o.audibleNotifications=$.grep(o.notSvc.notificationData.AudibleNotifications,function(n){return n.AudibleAlert==!0});o.audibleNotificationCount=0;$(o.audibleNotifications).each(function(){var n=this;n.Type==2&&n.Count>0&&o.audioQueue.push("/WebClient/Content/media/NewAwards.mp3");n.Type==3&&n.Count>0&&o.audioQueue.push("/WebClient/Content/media/NewShipments.mp3");n.Type==5&&n.Count>0&&o.audioQueue.push("/WebClient/Content/media/awardedprojects.mp3");n.Type==4&&n.Count>0&&o.audioQueue.push("/WebClient/Content/media/newprojects.mp3");n.Type==1&&n.Count>0&&o.audioQueue.push("/WebClient/Content/media/NewCheckCall.mp3");o.audibleNotificationCount+=Number(this.Count)});o.playAudioAlerts()})};o.startProcessingNotifications=function(){angular.isDefined(o.stopIntervalHandle)||(o.stopIntervalHandle=i(function(){o.updateNotifications()},v.NOTIFICATION_REFRESH_INTERVAL))};o.openCreateOrder=function(){h.location.href=u.ServerName+u.WebClientPath+"/#/OrderEntry"};o.stopProcessingNotifications=function(){angular.isDefined(o.stopIntervalHandle)&&(i.cancel(o.stopIntervalHandle),o.stopIntervalHandle=undefined)};o.$on("$destroy",function(){o.stopProcessingNotifications()});o.logincontrol=function(){return e.trustAsHtml(o.logincontrolhtml)};c.getNavigation(function(n){n.Menus&&(u.MenusPresent=!0);c.menuItemsData=n;c.menuItemsData&&(o.menus=o.buildtree(c.menuItemsData.Menus))});(o.isCarrier||u.isImpersonatingCarrier)&&(o.updateNotifications(),o.startProcessingNotifications());o.$watch("navSvc.menuItemsData",function(n){o.menus=o.buildtree(n.Menus)});a.getLoginControl(function(n){o.logincontrolhtml=n});o.stopTracking=function(){a.stopTracking()};o.logOut=function(){y.post("/WebClient/Account/LogOff",{},null,null);a.stopTracking()};o.click=function(n){switch(n){case"Reporting":c.refreshPaths();u.isImpersonatingCarrier?h.location.href=u.ServerName+u.WebClientPath+"/#/CarrierReport":u.isImpersonatingCustomer?y.post(u.ReportingPath,{LctId:"-5",LocId:u.impersonationLocationId},null,"_blank"):a.getLegacyUserContext(function(n){y.post(u.ReportingPath,n,null,"_blank")});break;case"Report Designer":case"SCDIT":y.post(u.ReportDesignerPath,null,null,"_blank");break;case"Order Entry":return window.open(u.ServerName+"/admin/shd.asp?shdP=OE","OE","width="+(screen.availWidth-25)+"px,height="+(screen.availHeight-45)+"px,scrollbars=1,toolbar=0,menubar=0,resizable=1,location=0,top=5,left=5"),!1;case"Partnership Advantage":return window.open(u.ServerName+"/carrier/NLM_Partnership_Advantage.asp","PartnershipAdvantage","width=600px,height=575px,scrollbars=yes,toolbar=1,menubar=1,resizable=1"),!1;case"Message Board":return window.open(u.ServerName+"/WebClient/#/BulletinBoard/2","BBoard","width=700px,height=600px,scrollbars=yes,titlebar=0,toolbar=0,menubar=0,resizable=1"),!1;case"User Guide":return window.open(u.ServerName+"/docs/XPONLM FORD ORDER ENTRY USER GUIDE 1.3.pdf","User Guide","width=700px,height=600px,scrollbars=yes,titlebar=0,toolbar=0,menubar=0,resizable=1"),!1}};o.buildtree=function(n){var t=[],i=function(n,i){t[i.Id]={action:i.Url?i.Url:"javaScript:",click:i.OnClick?i.OnClick:"",parentid:i.ParentId,querystring:i.QueryString?"?"+i.QueryString:"",submenus:[],target:i.Target=="JavaScript"?null:i.Target,title:i.Label}};return n?($.each(n,i),$.each(t,function(n,i){i&&i.parentid!==null&&t[i.parentid].submenus.push(i)}),jQuery(t).filter(function(){return this.parentid===null})):[]};o.impersonating=!1;o.impersonationError=!1;o.canChangeLocation=!1;o.ImpersonateLocationByNameViewModel={LocationName:""};o.currentImpersonation=n.get("ImpersonationLocationLoginName");o.adminImpersonationLocations="";o.adminDropdownSelectedLocation="";o.closePopover=function(){o.ImpersonateLocationByNameViewModel.LocationName="";o.impersonationError=!1};o.impersonationTextInputChanged=function(){o.impersonationError=!1;o.impersonationErrorMessage=""};o.adminImpersonationAttempts=0;o.adminImpersonationAttempts_LimitConst=5;o.adminImpersonateButtonOnClick=function(){o.ImpersonateLocationByNameViewModel.LocationName.length<1||a.adminImpersonateByLocationLoginName(o.ImpersonateLocationByNameViewModel,function(){a.refreshUserContext(function(){o.adminImpersonationAttempts=0;o.stopProcessingNotifications();(o.isCarrier||u.isImpersonatingCarrier)&&(o.updateNotifications(),o.startProcessingNotifications());(o.isCarrier||u.isImpersonatingCarrier)&&(u.carrierId=u.impersonationLocationId,u.isSPAView?r.path("/CarrierDashboard"):h.location.href=u.ServerName+u.WebClientPath+"/#/CarrierDashboard");(o.isCustomer||u.isImpersonatingCustomer)&&(u.customerLocationId=u.impersonationLocationId,u.isSPAView?r.path("/CustomerDashboard"):h.location.href=u.ServerName+u.WebClientPath+"/#/CustomerDashboard");o.currentImpersonation=o.ImpersonateLocationByNameViewModel.LocationName;a.getLocationsByLocationLoginName('"'+o.ImpersonateLocationByNameViewModel.LocationName+'"',function(n){o.impersonating=!0;o.adminImpersonationLocations=n;o.adminDropdownSelectedLocation=_.first(o.adminImpersonationLocations);f.reload()});c.getNavigationWithRefresh(function(n){c.menuItemsData=n})})},function(n,t){if(t==400)if(parseInt(o.adminImpersonationAttempts)>=parseInt(o.adminImpersonationAttempts_LimitConst))n[0].FieldName==="LocationName"&&n[0].Errors[0]==="hasPermission"&&(o.impersonationError=!0,o.impersonationErrorMessage="You do not have the impersonation feature enabled."),n[0].FieldName==="LocationName"&&n[0].Errors[0]==="invalidLocation"&&(o.impersonationError=!0,o.impersonationErrorMessage="Could not find location.");else{o.adminImpersonationAttempts=o.adminImpersonationAttempts+1;s("navigationImpersonationPtr_navigation();",850);return}})};navigationImpersonationPtr_navigation=o.adminImpersonateButtonOnClick();o.adminLocationDropdownOnSelect=function(n){o.adminDropdownSelectedLocation=n;w.setAdminLocation(n);a.adminImpersonateByLocationId(n,function(){c.getNavigationWithRefresh(function(n){c.menuItemsData=n;p.redirectToHome()});f.reload()})};o.dropAdminImpersonation=function(){a.dropAdminImpersonation(function(){c.getNavigationWithRefresh(function(n){c.menuItemsData=n});u.isImpersonatingCarrier=!1;u.isImpersonatingCustomer=!1;o.redirectService.redirectToHome()})};o.changeCarrierContact=function(n){o.carrierSelectedContact=n;u.isCarrier&&(u.carrierId=n.LocationId,w.setCarrierLocation(n));a.changeUserContact(o.carrierSelectedContact,function(){c.getNavigationWithRefresh(function(n){c.menuItemsData=n;p.redirectToHome()});f.reload()})};o.changeCustomerContact=function(n){o.customerSelectedContact=n;u.isCustomer&&(u.customerLocationId=n.LocationId,w.setCustomerLocation(n));a.changeUserContact(o.customerSelectedContact,function(){c.getNavigationWithRefresh(function(n){c.menuItemsData=n;p.redirectToHome()});f.reload()})};a.getLocationsByLocationLoginName('"'+n.get("ImpersonationLocationLoginName")+'"',function(t){if(n.get("ImpersonationLocationLoginName")==null)o.impersonating=!1;else{o.impersonating=!0;o.adminImpersonationLocations=t;try{$.each(o.adminImpersonationLocations,function(t,i){if(i.LocationId==n.get("ImpersonationLocationId")){o.adminDropdownSelectedLocation=i;return}})}catch(i){o.adminDropdownSelectedLocation=_.first(o.adminImpersonationLocations)}finally{w.setAdminLocation(o.adminDropdownSelectedLocation)}}});a.getUserContacts(function(t){if(o.carrierContacts=t,o.customerContacts=t,t.length>1&&(o.canChangeLocation=!0),n.get("ActiveContact")){var i=_.find(t,{Id:Number(n.get("ActiveContact"))});i?(o.carrierSelectedContact=i,o.customerSelectedContact=i,u.isCarrier?w.setCarrierLocation(o.carrierSelectedContact):w.setCustomerLocation(o.customerSelectedContact)):(o.carrierSelectedContact=_.first(o.carrierContacts),o.customerSelectedContact=_.first(o.customerContacts),u.isCarrier?w.setCarrierLocation(o.carrierSelectedContact):w.setCustomerLocation(o.customerSelectedContact))}o.initializeWindowSize()});o.$watch("windowWidth",function(){o.showCompactSearch=(o.isAdmin||o.isSuperAdmin)&&o.windowWidth<1400?!0:u.isImpersonatingCarrier&&o.windowWidth<2025?!0:u.isImpersonatingCustomer&&o.windowWidth<1800?!0:o.isCarrier&&o.canChangeLocation&&o.windowWidth<1975?!0:o.isCustomer&&o.canChangeLocation&&o.windowWidth<1750?!0:o.isCarrier&&!o.canChangeLocation&&o.windowWidth<1700?!0:o.isCustomer&&!o.canChangeLocation&&o.windowWidth<1450?!0:!1;o.showCompactProfile=(o.isAdmin||o.isSuperAdmin)&&o.windowWidth<1275?!0:u.isImpersonatingCarrier&&o.windowWidth<1875?!0:u.isImpersonatingCustomer&&o.windowWidth<1650?!0:o.isCarrier&&o.canChangeLocation&&o.windowWidth<1800?!0:o.isCustomer&&o.canChangeLocation&&o.windowWidth<1600?!0:o.isCarrier&&!o.canChangeLocation&&o.windowWidth<1525?!0:o.isCustomer&&!o.canChangeLocation&&o.windowWidth<1325?!0:!1;o.showCompactLocationSelect=u.isImpersonatingCarrier&&o.windowWidth<1650?!0:u.isImpersonatingCustomer&&o.windowWidth<1425?!0:o.isCarrier&&o.canChangeLocation&&o.windowWidth<1650?!0:o.isCustomer&&o.canChangeLocation&&o.windowWidth<1450?!0:!1});o.playAudioAlerts=function(){var t,n;try{if(o.audioQueue.length==0)return;t=!!h.document.createElement("audio").canPlayType;t?(n=new Audio(o.audioQueue.shift()),n.addEventListener("ended",o.playAudioAlerts),n.play()):h.document.embeds&&b(o.audioQueue)}catch(i){window.console&&console.error("Error:"+i)}}}]);xpoNlmModule.controller("AvailableOpportunitiesModalInstanceController",["$rootScope","$scope","$uibModalInstance","openShipmentsService","shipment","state",function(n,t,i,r,u,f){"use strict";(function(){t.service=r;t.shipment=u;t.state=f;t.cancel=function(){i.dismiss("cancel")}})()}]);xpoNlmModule.controller("OpenShipmentDetailsModalInstanceController",["$rootScope","$scope","$uibModalInstance","openShipmentsService","shipment","state","specializedService",function(n,t,i,r,u,f,e){"use strict";(function(){t.CONTAINER_MODE_GROUP=9;t.service=r;t.shipment=u;t.state=f;t.cancel=function(){i.dismiss("cancel")};t.convertFromInches=e.convertInchesToFeetAndDisplay})()}]);xpoNlmModule.controller("OpenShipmentsController",["$rootScope","$scope","$uibModal","$interval","carrierTrustsService","carrierService","openShipmentsService","openShipmentsFilterService","specializedService","featureService","appActiveUserService",function(n,t,i,r,u,f,e,o,s,h,c){"use strict";var p=function(){t.state.showFilters=!t.state.showFilters},l,a,y,v;t.HideShowValue="hide";t.HideShowChar="+";t.HideShowFilterBox=function(){$("#searchpanel").is(":visible")||($("#searchpanel").removeClass("hidden"),$("#searchpanel").removeClass("in"));t.HideShowValue=="show"?(t.HideShowValue="hide",t.HideShowChar="+"):(t.HideShowValue="show",t.HideShowChar="-")};y=function(){c.activeId!=null&&(t.carrierId=c.activeId,function(){var n=[{Id:t.carrierId,Name:"Home Location"},{Id:-999,Name:"All Locations"}],i,r;_.assign(t,{trustedLocation:_.find(n,{Id:-999})});i=function(){var i=[],r=function(n){t.trustedLocation=n;o.setFilteredShipments(t.service.shipments,t.filters,t.trustedLocation.Id)};i=_.union.apply(null,[n,u.carrierTrusts]);_.assign(t,{selectLocation:r,trustedLocation:_.find(i,{Id:-999}),trustedLocations:i})};r=angular.noop;u.getCarrierTrusts.apply(null,[t.carrierId,i,r])}(),function(){t.service=e;f.getFeatures(t.carrierId).then(function({data:n}){t.features={autoMinimizeExpiredBid:_.find(n,{FeatureTypeId:261}),createProjectAuction:_.find(n,{FeatureTypeId:292}),locationTrust:_.find(n,{FeatureTypeId:16}),managePartsAndPieces:_.find(n,{FeatureTypeId:466}),noShipUpdateConfirmation:_.find(n,{FeatureTypeId:202}),noShipBidConfirmation:_.find(n,{FeatureTypeId:201}),onlineInvoicing:_.find(n,{FeatureTypeId:11}),onlineReporting:_.find(n,{FeatureTypeId:14}),openShipRefreshPrompt:_.find(n,{FeatureTypeId:340}),paymentVerification:_.find(n,{FeatureTypeId:615}),paymentVerificationOnly:_.find(n,{FeatureTypeId:622}),rejectedImagesEmailAlert:_.find(n,{FeatureTypeId:775}),revenueDashboardAccess:_.find(n,{FeatureTypeId:752}),serviceFailures:_.find(n,{FeatureTypeId:24}),shipDetailsAutoPopup:_.find(n,{FeatureTypeId:51}),webAlertAudio:_.find(n,{FeatureTypeId:212}),webAlertVisual:_.find(n,{FeatureTypeId:314}),UserBidOverTariff:_.find(n,{FeatureTypeId:830})}});t.isFamilyCarrier=!1;h.isFeatureEnabled(t.carrierId,7,826,function(i){t.isFamilyCarrier=i;t.isFamilyCarrier&&n.$emit("isFamilyCarrier")},function(){t.isFamilyCarrier=!1});_.assign(t,{shipments:t.service.shipments,toggleFilters:p});var r=function(){n.$emit("openShipmentsRefreshed");o.setFilteredShipments(t.service.shipments,t.filters,t.trustedLocation.Id)},u=function(t){var r={templateUrl:n.WebClientPath+"/Modules/XpoNlm/Common/Views/MessageModal.html",controller:"MessageModalInstanceController",resolve:{message:function(){return t.ExceptionMessage?t.ExceptionMessage:t.Message?t.Message:typeof t=="string"?t:void 0},messageType:function(){return"error"}},windowClass:"small-Message-Modal mt-expedite-legacy"};i.open(r)};t.service.getOpenShipments(t.carrierId,r,u);t.service.getAircraftList(t.carrierId,function(n){t.service.aircraftList=n});t.service.getAboveTariffReasonCodes(function(n){t.service.aboveTariffReasonCodes=n});t.service.getRefusalReasons(function(n){t.service.refusalReasons=n});t.service.getTurnBackReasons(function(n){t.service.turnBackReasons=n});t.service.getMexicoBorderStops(function(n){t.service.MexicoBorderStops=n});l&&l();l=n.$on("refreshOpenShipments",function(){t.service.getOpenShipments(t.carrierId,r,u)});t.downloadAwardDetails=function(n){kendo.drawing.drawDOM(angular.element("#awardDetailsPage")).then(function(t){kendo.drawing.pdf.saveAs(t,"AwardDetails-"+n+".pdf")})};t.convertFromInches=s.convertInchesToFeetAndDisplay}())};a&&c.unsubscribe(a);a=c.subscribe(y);countdown.setLabels("|s|m|h|d||||||","|s|m|h|d||||||"," "," ");v=r(function(){t.$broadcast("countdown")},1e3);t.$on("$destroy",function(){v&&r.cancel(v);l&&l();a&&c.unsubscribe(a)})}]);xpoNlmModule.controller("ContactModalInstanceController",["$rootScope","$scope","$uibModalInstance","customerUserManagerService","locationId",function(n,t,i,r,u){t.hasError=!1;t.contact={Id:null,FirstName:null,LastName:null,Name:" ",PhoneNumber:null,PhoneNumberExtension:null,MobilePhoneNumber:null,EmailAddress:null,FaxNumber:null,LocationContactId:null,LocationId:u,AdditionalInfo:null,IsUserManager:!1,IsEmergencyContact:!1,HasLocationTrustPermission:!1,EmailAlertPreference:0,EmailAlertStartTime:null,EmailAlertEndTime:null,FeatureAlerts:[],CustomerFeatures:[]};t.validateInput=function(){return t.contact.FirstName?t.contact.LastName?typeof t.contact.PhoneNumber=="undefined"?(t.hasError=!0,t.errorsContact="Invalid Phone Number.",!1):typeof t.contact.PhoneNumberExtension=="undefined"?(t.hasError=!0,t.errorsContact="Invalid Phone Number Extension.",!1):typeof t.contact.EmailAddress=="undefined"?(t.hasError=!0,t.errorsContact="Invalid Email Address.",!1):typeof t.contact.FaxNumber=="undefined"?(t.hasError=!0,t.errorsContact="Invalid Fax Number.",!1):!0:(t.hasError=!0,t.errorsContact="Last Name required.",!1):(t.hasError=!0,t.errorsContact="First Name required.",!1)};t.insertContact=function(){t.validateInput()&&(r.insertContact(u,t.contact).then(function({data:n}){i.close(n)},function({data:n,status:i}){t.hasError=!0;t.errorsContact="ERROR: ("+i+") "+n.Message}),n.$broadcast("updateLocationContacts",{contactAdded:t.contact}))};t.cancel=function(){i.dismiss("cancel")}}]);xpoNlmModule.controller("CustomerOrderEntryController",["$scope","$rootScope","$uibModal","$window","$timeout","$cookies","appAddressDataService","orderEntryData","orderEntryService","customerData","vehicleListService","commoditiesService","customQualifierService","mileageService","shipmentService","modalService","specializedService","customersService","userLocationTypeService","locationGroupService",function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d){n.CUSTOMER_FORD_MOTOR=1;n.CUSTOMER_FORD_POWERTRAIN=23;n.CUSTOMER_GENERAL_MOTORS=3;n.CUSTOMER_STELLANTIS=4;n.PAYMENT_TERMS_PREPAID=2;n.PAYMENT_TERMS_COLLECT=3;n.PAYMENT_TERMS_THIRD_PARTY=4;n.MODE_GROUP_UNKNOWN=-1;n.MODE_GROUP_GROUND_EXPEDITE=1;n.MODE_GROUP_TRUCKLOAD=2;n.MODE_GROUP_AIR=3;n.MODE_GROUP_AIR_CHARTER=4;n.MODE_GROUP_CONTAINER=9;n.MODE_GROUP_INTERNATIONAL=10;n.MODE_GROUP_SPECIALIZED=7;n.MODE_TYPE_SHORT_TERM_DEDICATED=62;n.PARTNUMBER_AUTOCOMPLETE_COMBOBOX=20;n.SCHEDULE_ENTRY_FREQUENCY_EVERY=2;n.SCHEDULE_ENTRY_FREQUENCY_CALENDAR=3;n.BLUE_YONDER_GROUP_ID=241;n.stellantisVehichleTypes=[12,35,287,335,336,337,338,339,357,360,364];n.wbsValidated=!0;n.aetcValidated=!0;n.backhaulAetcValidated=!0;n.data=o;n.addressData=e;n.$watch("initialForm.$dirty",function(){n.initialForm.$dirty&&u(function(){et(n.contentForm)})});n.$watchCollection("initialForm.$error",function(t){n.editMode=!t||!Object.keys(t).length});n.$watchGroup(["data.shipment.CustomerId","data.shipment.ModeGroupId"],function(){if(!n.data.shipment.CustomerId){n.data.commodities=[];return}n.data.shipment.CustomerId==4&&(n.data.shipment.ModeGroupId=n.MODE_GROUP_UNKNOWN);k.getLocationTypes(function(){n.data.userLocationTypes=k.LocationTypes;kt();n.data.allowBlueYonder||d.getLocationGroupMembers(n.BLUE_YONDER_GROUP_ID).then(function({data:t}){n.data.restrictedLocationIds=t.map(n=>n.LocationId)})},function(n){nt(n)});n.data.shipment.ModeGroupId&&n.data.shipment.CustomerId?(n.loadingCommodities=!0,l.getCommodities(n.data.shipment.CustomerId,n.data.shipment.ModeGroupId,function(){n.loadingCommodities=!1;n.data.commodities=l.Commodities},function(t){n.loadingCommodities=!1;nt(t)}),n.loadingVehicleTypes=!0,c.getVehicleList(n.data.shipment.CustomerId,n.data.shipment.ModeGroupId,function(){n.loadingVehicleTypes=!1;n.data.vehicleTypes=c.vehicleList;n.data.shipment.CustomerId===n.CUSTOMER_STELLANTIS&&(n.data.vehicleTypes=n.data.vehicleTypes.filter(t=>n.stellantisVehichleTypes.includes(t.Id)))},function(t){n.loadingVehicleTypes=!1;nt(t)})):n.data.vehicleTypes=null;n.data.shipment.CustomerId===n.CUSTOMER_GENERAL_MOTORS&&n.data.shipment.ModeGroupId===n.MODE_GROUP_SPECIALIZED&&(n.data.shipment.IsAutoExport=!1)});n.$watch("data.shipment.ModeTypeId",function(){n.data.modeTypes&&(n.data.modeTypes=n.data.shipment.ModeTypeId===n.MODE_TYPE_SHORT_TERM_DEDICATED?n.data.modeTypes.concat({Id:n.MODE_TYPE_SHORT_TERM_DEDICATED,Name:"S-T Ded"}):n.data.modeTypes.filter(t=>t.Id!==n.MODE_TYPE_SHORT_TERM_DEDICATED))});n.$watchGroup(["data.shipment.CommodityId","data.shipment.CustomerId","data.shipment.ModeGroupId"],function(){n.data.shipment.CommodityForFord=(n.data.shipment.CommodityId===1||n.data.shipment.CommodityId===2||n.data.shipment.CommodityId===4)&&(n.data.shipment.CustomerId===n.CUSTOMER_FORD_MOTOR||n.data.shipment.CustomerId===n.CUSTOMER_FORD_POWERTRAIN)&&(n.data.shipment.ModeGroupId===n.MODE_GROUP_UNKNOWN||n.data.shipment.ModeGroupId===n.MODE_GROUP_TRUCKLOAD)});n.loadingCustomers=!0;s.getCustomers(function(t){n.loadingCustomers=!1;n.customers=t;n.customerAccessDenied=_.isEmpty(t)},function(t){n.loadingCustomers=!1;nt(t)});n.loadingNoteTypes=!0;s.getNoteTypes(function(){n.loadingNoteTypes=!1;n.data.noteTypes=s.noteTypes;n.data.defaultNoteTypeId=_.find(s.noteTypes,function(n){return n.NtpType==="VCS"}).NtpId;ut()},function(t){n.loadingNoteTypes=!1;nt(t)});n.cloneSuccessCallback=function(){n.initialForm.$setDirty();n.data.shipment=angular.copy(s.shipment);n.data.shipment.Stops&&n.data.shipment.Stops[0].LocationCode!==null&&(n.stopOrigin=n.data.shipment.Stops[0],n.data.shipment.Stops[0].LocationId===n.data.shipment.OriginalShipperLocationId&&(n.sameAsOrigin=!0));n.data.shipment.Stops&&n.data.shipment.Stops[1].LocationCode!==null&&(n.stopDestination=n.data.shipment.Stops[1],n.data.shipment.Stops[1].LocationId===n.data.shipment.FinalConsigneeLocationId&&(n.sameAsDestination=!0));n.data.shipment.ModeGroupId===n.MODE_GROUP_SPECIALIZED&&n.data.shipment.Dimensions.forEach(function(n){var t=w.convertInchesToFeet(n.Length),i=w.convertInchesToFeet(n.Width),r=w.convertInchesToFeet(n.Height);n.LengthFeet=t[0];n.WidthFeet=i[0];n.HeightFeet=r[0];n.LengthInches=t[1];n.WidthInches=i[1];n.HeightInches=r[1]});tt();n.customer=_.find(n.customers,{Id:n.data.shipment.CustomerId}).Id;lt();u(function(){ot()})};n.calculateDimensionTotals=function(){if(n.data.shipment.Dimensions?.length){let t=n.data.shipment.Dimensions,i=t.map(n=>n.EnteredAsMetric?n.Weight*2.20462262:n.Weight).reduce((n,t)=>n+t,0),r=Math.max(...[Math.max(...t.map(n=>n.EnteredAsMetric?n.Length*.39370079:n.Length)),Math.max(...t.map(n=>n.EnteredAsMetric?n.Width*.39370079:n.Width)),Math.max(...t.map(n=>n.EnteredAsMetric?n.Height*.39370079:n.Height))]),u=t.map(n=>n.Quantity).reduce((n,t)=>n+t,0),f=Math.max(...t.map(n=>n.EnteredAsMetric?n.WeightPerPackage*2.20462262:n.WeightPerPackage));n.showAirModeType=!1;u<=4&&r<=50&&i<=750&&!n.IsIntraMexico&&n.IsInterMexico&&n.totalMileage>100&&n.airDeliveryTime100&&n.airDeliveryTime0&&n.data.shipment.Notes[0].TypeId==-3&&(n.data.shipment.IsAutoExport=!1);n.submitting=!0;s.insertShipment(n.data.shipment,n.originCountryCode,n.destinationCountryCode,function(t){n.submitting=!1;pt(t)},function(t){n.submitting=!1;nt(t)})};n.customerChanged=function(){st();n.data.shipment.CustomerId=n.customer;lt()};n.modeGroupIdChanged=function(){ct();ht(_.find(n.data.modeGroups,{Id:n.data.shipment.ModeGroupId}));n.data.shipment.ModeTypeId=n.data.modeTypes&&n.data.modeTypes.length===1?n.data.modeTypes[0].Id:null;ut();n.data.shipment.ModeGroupId&&n.data.shipment.ModeGroupId===n.MODE_GROUP_TRUCKLOAD?n.data.shipment.PremiumCodeId=null:n.data.shipment.ProjectDeviationReasonCodeId=null};n.modeTypeIdChanged=function(){ct()};n.onWbsChange=function(){n.wbsValidated=!1};n.onAetcChange=function(){n.aetcValidated=!1};n.onBackhaulAetcChange=function(){n.backhaulAetcValidated=!1};n.paymentTermsIdChanged=function(){n.data.shipment.PremiumCodeId=null;n.data.shipment.ProjectDeviationReasonCodeId=null;switch(n.data.shipment.PaymentTermsId){case n.PAYMENT_TERMS_COLLECT:n.data.shipment.PayorLocationId=n.data.shipment.FinalConsigneeLocationId;break;case n.PAYMENT_TERMS_PREPAID:n.data.shipment.PayorLocationId=n.data.shipment.CallerLocationId;break;case n.PAYMENT_TERMS_THIRD_PARTY:n.data.shipment.PayorLocationId=n.paymentResults.DefaultPayorLocationId}};n.vehicleChanged=function(t){var i=n.data?.vehicleTypes?.find(n=>n.Id===t);i?.AutoSelectTarpsOnSpecializedShipments&&(n.data.shipment.Tarps=!0)};n.stopLocationIdChanged=function(t,i,r){i?([n.CUSTOMER_FORD_MOTOR,n.CUSTOMER_FORD_POWERTRAIN].includes(n.data.shipment.CustomerId)&&[n.MODE_GROUP_TRUCKLOAD,n.MODE_GROUP_UNKNOWN].includes(n.data.shipment.ModeGroupId)?(n.sameAsOrigin=null,t.LocationId!==null&&n.selectedLocationCode&&n.selectedLocationCode.length===5?(n.stopOrigin=t,n.stopOrigin.LocationCode=n.selectedLocationCode):n.stopOrigin=null,n.data.shipment.OriginalShipperLocationId=null,n.data.shipment.OriginalShipperLocationCode=null):(n.data.shipment.OriginalShipperLocationId=t.LocationId,n.data.shipment.PayorLocationId=null,n.data.shipment.CarrierId=null),n.originCountryCode=n.selectedLocationCountry):r&&([n.CUSTOMER_FORD_MOTOR,n.CUSTOMER_FORD_POWERTRAIN].includes(n.data.shipment.CustomerId)&&[n.MODE_GROUP_TRUCKLOAD,n.MODE_GROUP_UNKNOWN].includes(n.data.shipment.ModeGroupId)?(n.sameAsDestination=null,t.LocationId!==null&&n.selectedLocationCode&&n.selectedLocationCode.length===5?(n.stopDestination=t,n.stopDestination.LocationCode=n.selectedLocationCode):n.stopDestination=null,n.data.shipment.FinalConsigneeLocationId=null,n.data.shipment.FinalConsigneeLocationCode=null):(n.data.shipment.FinalConsigneeLocationId=t.LocationId,n.data.shipment.PayorLocationId=null,n.data.shipment.CarrierId=null),n.destinationCountryCode=n.selectedLocationCountry);n.partAutocompleteDataSource=null;n.partDropdownDataSource=null;t.CloseTime=null;n.setDriveTime();n.calculateCloseTime()};n.originalShipperLocationIdChanged=function(){n.data.shipment.PayorLocationId=null;ft();n.sameAsOrigin=!1;n.data.shipment.OriginalShipperLocationId?(n.data.shipment.OriginalShipperLocationCode=n.selectedLocationCode,n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null&&(n.loadingPartDetails=!0,tt())):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.finalConsigneeLocationIdChanged=function(){n.data.shipment.PayorLocationId=null;n.data.shipment.calculatedArrivalTime=null;ft();n.sameAsDestination=!1;n.data.shipment.FinalConsigneeLocationId?(n.data.shipment.FinalConsigneeLocationCode=n.selectedLocationCode,n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null&&(n.loadingPartDetails=!0,tt())):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.payorLocationIdChanged=function(){};n.sameAsOriginCheckboxChange=function(){n.data.shipment.OriginalShipperLocationId=n.sameAsOrigin?null:n.stopOrigin.LocationId;n.data.shipment.OriginalShipperLocationCode=n.sameAsOrigin?null:n.stopOrigin.LocationCode;n.data.shipment.PayorLocationId=null;n.data.shipment.CarrierId=null;n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null?(n.loadingPartDetails=!0,tt()):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.sameAsDestinationCheckboxChange=function(){n.data.shipment.FinalConsigneeLocationId=n.sameAsDestination?null:n.stopDestination.LocationId;n.data.shipment.FinalConsigneeLocationCode=n.sameAsDestination?null:n.stopDestination.LocationCode;n.partAutocompleteDataSource=null;n.partDropdownDataSource=null;n.data.shipment.PayorLocationId=null;n.data.shipment.CarrierId=null;n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null?(n.loadingPartDetails=!0,tt()):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.setDriveTime=function(){if(!wt()){n.driveTime=null;n.calculatedArrivalTime=null;n.additionalMileageInfo=null;return}n.loadingMileage=!0;v.getMileage(n.data.shipment.Stops.map(n=>n.LocationId),n.data.shipment.CustomerId,n.data.shipment.ReadyDateTime,n.data.shipment.IsHazmat,function(t){if(n.loadingMileage=!1,n.totalMileage=t.Mileage,t&&(t.TransitTimeInMinutes||t.TotalTransitTimeInMinutes)){n.driveTime=g(t.TransitTimeInMinutes)+" ("+t.Mileage+" miles)";n.unformattedCalculatedArrivalTime=t.CalculatedArrivalDateTime;n.calculatedArrivalTime=moment(t.CalculatedArrivalDateTime).format("MM/DD/YYYY HH:mm");n.data.shipment.calculatedArrivalTime=n.calculatedArrivalTime;n.airDeliveryTime=t.AirDeliveryTime;t.AirDeliveryTime":"",i+=t.NonMXDriveTimeInMinutes?"Drive Time Non-MX: "+g(t.NonMXDriveTimeInMinutes)+"
":"",i+=t.MXMilesPerHour?"Speed MX: "+t.MXMilesPerHour+" mph
":"",i+=t.MXDriveTimeInMinutes?"Drive Time MX: "+g(t.MXDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.MexicoBorderCrossingTimeInMinutes?"Border Crossing: "+g(t.MexicoBorderCrossingTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.MXBorderLoadTime?"Border Load Time: "+g(t.MXBorderLoadTime)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":""):n.data.shipment.CustomerId===n.CUSTOMER_STELLANTIS&&n.IsIntraMexico?(i+=t.MilesPerHour?"Speed: "+t.MXMilesPerHour+" mph
":"",i+=t.TotalDriveTimeInMinutes?"Drive Time: "+g(t.TotalDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":""):n.data.shipment.IsDirectTransit?(i+=t.MilesPerHour?"Speed: "+t.MilesPerHour+" mph
":"",i+=t.TotalDriveTimeInMinutes?"Drive Time: "+g(t.TotalDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.CanadaBorderCrossingTimeInMinutes?"Border Crossing: "+g(t.CanadaBorderCrossingTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":"",n.data.shipment.calculatedArrivalTime=n.calculatedArrivalTime,n.data.shipment.ProtectDateTime=n.calculatedArrivalTime):(i+=t.MilesPerHour?"Speed: "+t.MilesPerHour+" mph
":"",i+=t.TotalDriveTimeInMinutes?"Drive Time: "+g(t.TotalDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.CanadaBorderCrossingTimeInMinutes?"Border Crossing: "+g(t.CanadaBorderCrossingTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":"");n.additionalMileageInfo=i.length>0?i:null;$("#mileageInfo").data("kendoTooltip")&&$("#mileageInfo").data("kendoTooltip").destroy();$("#mileageInfo").kendoTooltip({filter:"span",position:"top",content:function(){return n.additionalMileageInfo}}).data("kendoTooltip")}},function(t){n.loadingMileage=!1;nt(t)})};n.calculateCloseTime=function(){let t=new Date(n.data.shipment.ReadyDateTime).getDay(),i=new Date(n.data.shipment.ProtectDateTime).getDay();n.data.shipment.Stops.forEach(r=>{var u;isNaN(t)||r.Sequence==1&&(u=function(n){n?.DaysOfWeek&&!n?.DaysOfWeek?.every(n=>n.LocSchId===0)&&(r.CloseTime=n.DaysOfWeek[t].CloseTimestr.slice(0,5),r.OpenTime=n.DaysOfWeek[t].OpenTimestr?.slice(0,5),r.CloseTime=="00:00"&&r.OpenTime=="00:00"&&(r.IsClosedToday=!0),r.Is24Hour=n.DaysOfWeek[t].Is24Hour,r.EnforceHour=n.EnforceHour,r.ShowOverride=!1)},n.addressData.getLocation(r.LocationId,u));isNaN(i)||r.Sequence==Math.max(...n.data.shipment.Stops.map(n=>n.Sequence))&&(u=function(n){n?.DaysOfWeek&&!n?.DaysOfWeek?.every(n=>n.LocSchId===0)&&(r.CloseTime=n.DaysOfWeek[i].CloseTimestr.slice(0,5),r.OpenTime=n.DaysOfWeek[i].OpenTimestr?.slice(0,5),r.CloseTime=="00:00"&&r.OpenTime=="00:00"&&(r.IsClosedToday=!0),r.Is24Hour=n.DaysOfWeek[i].Is24Hour,r.EnforceHour=n.EnforceHour,r.ShowOverride=!1)},n.addressData.getLocation(r.LocationId,u))})};n.validateWbs=function(){s.validateWBS(n.data.shipment.WBSNumber,function(t){t?.Errors?.length?(n.wbsValidated=!1,t.Errors.push("Try to inputing the WBS number again without the dashes"),t.Errors.push("If the WBS number is still not found after removing the dashes, remove the WBS number"),nt(t)):n.wbsValidated=!0},function(t){n.wbsValidated=!1;nt(t)})};n.validateAETC=function(){s.validateAETC(n.data.shipment.AuthorizationCode,n.customer,function(t){at(t);n.aetcValidated=!0},function(t){n.aetcValidated=!1;nt(t)})};n.validateBackhaulAetc=function(){s.validateAETC(n.data.shipment.BackhaulAetcCode,n.customer,function(){n.backhaulAetcValidated=!0},function(t){n.backhaulAetcValidated=!1;nt(t)})};Object.defineProperty(n,"carrierCanBeDetermined",{get:function(){return n.data&&n.data.shipment&&n.data.shipment.ModeGroupId&&n.data.shipment.Stops[0].LocationId&&n.data.shipment.Stops[n.data.shipment.Stops.length-1].LocationId&&n.data.shipment.CustomerId}});n.$watchGroup(["data.shipment.Stops[0].LocationId","data.shipment.Stops[data.shipment.Stops.length - 1].LocationId","data.shipment.ModeGroupId","data.shipment.ProtectDateTime"],function(){n.carrierCanBeDetermined&&(vt(),yt())});Object.defineProperty(n,"payorCanBeDetermined",{get:function(){return n.data&&n.data.shipment&&n.data.shipment.CallerLocationId&&n.data.shipment.Stops[0].LocationId&&n.data.shipment.Stops[n.data.shipment.Stops.length-1].LocationId&&n.data.shipment.OriginalShipperLocationId&&n.data.shipment.FinalConsigneeLocationId&&n.customer}});n.$watchGroup(["data.shipment.Stops[0].LocationId","data.shipment.Stops[data.shipment.Stops.length - 1].LocationId","data.shipment.OriginalShipperLocationId","data.shipment.FinalConsigneeLocationId"],function(){n.payorCanBeDetermined&&ft()});n.showTeamServiceMessage=function(){n.data.shipment.TeamService=!1;p.openMessageModal("Pleaase note that your request for Team Service Required may not be needed on this order. However, we will funish Team Service at your request. Please note additional charges will apply for Team Service Required. Is this acceptable?","warning",bt)};var et=function(n){n.$$controls!==undefined&&n.$$controls.forEach(n=>{et(n)});n.$setTouched!==undefined&&n.$setTouched()},it={NtpId:54,NtpType:"Project"},ut=function(){n.data?.shipment?.ModeGroupId&&n.data.shipment.ModeGroupId===n.MODE_GROUP_TRUCKLOAD?_.findIndex(s.noteTypes,it)===-1&&n.data.noteTypes.push(it):(_.remove(n.data.noteTypes,it),n.data.shipment&&n.data.shipment.Notes&&_.remove(n.data.shipment.Notes,function(n){return n.NoteType===it.NtpId}));n.data.defaultNoteTypeId&&(n.data.noteType=n.data.defaultNoteTypeId)},at=function(t){n.callerForm.$setDirty();n.routeForm.$setDirty();n.billingForm.$setDirty();n.shipmentForm.$setDirty();n.data.shipment.Stops[0].LocationId=t.OriginLocationId;n.data.shipment.Stops[1].LocationId=t.DestinationLocationId;n.data.shipment.OriginalShipperLocationId=t.SupplierLocationId;n.data.shipment.PayorLocationId=t.FinalConsigneeLocationId;n.data.shipment.FinalConsigneeLocationId=t.FinalConsigneeLocationId;n.data.shipment.IsHazmat=t.PartIsHazmat;n.data.shipment.PremiumCodeId=t.PremiumCodeId;n.originCountryCode=t.OriginCountryCode;n.destinationCountryCode=t.DestinationCountryCode;n.data.shipment.MexicoCrossBorderProgram=t.DestinationCountryCode==="MX"&&t.OriginCountryCode!=="MX"||t.OriginCountryCode==="MX"&&t.DestinationCountryCode!=="MX";n.IsInterMexico=n.data.shipment.MexicoCrossBorderProgram;n.IsIntraMexico=t.DestinationCountryCode==="MX"&&t.OriginCountryCode==="MX"},ot=function(){n.contentForm.$setPristine();n.contentForm.$setUntouched();n.shipmentForm.$setSubmitted();n.data.shipment.IsCustomerOE=!0;ht(_.find(n.data.modeGroups,{Id:n.data.shipment.ModeGroupId}));ut()},vt=function(){n.carrierCanBeDetermined&&s.getEligibleCarrierResults(n.data.shipment,function(t){n.preferredCarriers=_.size(t)>0?t:null},function(n){nt(n)})},yt=function(){n.carrierCanBeDetermined&&s.getTruckloadFailingCarrierList(n.data.shipment.CustomerId,function(t){n.failingCarriers=_.size(t)>0?t.map(n=>({Id:n.SCAC,Name:n.Name})):null},function(n){nt(n)})},st=function(){n.editMode=!1;n.wbsValidated=!0;n.aetcValidated=!0;n.backhaulAetcValidated=!0;n.stopOrigin=null;n.stopDestination=null;n.sameAsDestination=null;n.sameAsOrigin=null;n.data.shipment={NumberOfShipments:1,Stops:[{StopType:1,Sequence:1},{StopType:2,Sequence:2}]};n.paymentTermsList=angular.copy(n.data.paymentTermsList);n.data.shipment.CallerLocationId=_.isEmpty(t.impersonationLocationId)?t.customerLocationId:t.impersonationLocationId;n.data.shipment.CallerContactId=parseInt(f.get("ActiveContact"),10)},rt=function(){n.editMode=!1;n.reviewed=!1;n.wbsValidated=!0;n.aetcValidated=!0;n.backhaulAetcValidated=!0;n.data.shipment=null;n.stopOrigin=null;n.stopDestination=null;n.sameAsDestination=null;n.sameAsOrigin=null;n.customer=null;n.cloneData=null;n.partAutocompleteDataSource=null;n.partDropdownDataSource=null;n.validationErrors=null;st();u(function(){ot()})},pt=function(n){var r,u,f;n.ProjectId?(r=n.ProjectId,u=!0):(r=n.ShipmentIds,u=!1);f=i.open({templateUrl:t.WebClientPath+"/Modules/XpoNlm/OrderEntry/Views/CustomerSuccessModal.html",controller:"CustomerOrderEntrySuccessModalInstanceController",resolve:{id:function(){return r},isProject:function(){return u}},windowClass:"order-Entry-Success-Modal mt-expedite-legacy"});f.result.then(function(n){n&&rt()},angular.noop)},nt=function(n){var t=[];n.Message&&t.push(n.Message);n.ExceptionMessage&&t.push(n.ExceptionMessage);n.Errors&&(t=_.union(t,n.Errors));p.openMessageListModal(t,"error")},tt=function(){n.partDropdownDataSource=null;n.partAutocompleteDataSource=null;n.loadingPartDetails=!0;s.getParts(n.data.shipment.OriginalShipperLocationCode,n.data.shipment.FinalConsigneeLocationCode,function(t){n.loadingPartDetails=!1;n.hazmatParts=[];r.isSelect=!1;r.previousValue="";t!==null&&(t.length>n.PARTNUMBER_AUTOCOMPLETE_COMBOBOX?(n.partDropdownDataSource=null,n.partAutocompleteDataSource={dataTextField:"PartNumber",dataValueField:"PartNumber",dataSource:t,minLength:3,template:'
#:data.PartNumber#<\/span>*<\/span>

Desc: #:data.Description#<\/font><\/p><\/div>',filter:"contains",dataBound:function(n){var t=n.sender._prev,i=n.sender.ul.children();i.length>0&&t.length>2&&$(i).find("span.partName").each(function(n,i){var r=$(i).text(),u=""+r.substr(r.toLowerCase().indexOf(t.toLowerCase()),t.length)+"<\/strong>";i.innerHTML=r.replace(r.substr(r.toLowerCase().indexOf(t.toLowerCase()),t.length),u)})},close:function(){isSelect=!1},change:function(t){isSelect||(n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._prev)}),$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:"),n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply()))},select:function(t){isSelect=!0;n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._old)});$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:");n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply());t.dataItem.IsHazmat?($("#"+this.element.attr("id")).parent().parent().siblings("label").children().length||$("#"+this.element.attr("id")).parent().parent().siblings("label").append('    HAZMAT<\/span>'),n.data.shipment.IsHazmat=!0,n.hazmatParts.length>0&&n.hazmatParts.indexOf(t.dataItem.PartNumber)!==-1||n.hazmatParts.push(t.dataItem.PartNumber),n.$apply()):$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:")}}):t.length<=n.PARTNUMBER_AUTOCOMPLETE_COMBOBOX&&t.length>0&&(n.partAutocompleteDataSource=null,n.partDropdownDataSource={dataTextField:"PartNumber",dataValueField:"PartNumber",dataSource:t,optionLabel:"Select a Part",clearButton:!1,ValuePrimitive:!0,template:'

#:data.PartNumber#<\/span>*<\/span>

Desc: #:data.Description#<\/font><\/p><\/div>',close:function(){isSelect=!1},open:function(n){previousValue=n.sender._inputWrapper[0].textContent},change:function(t){isSelect||(n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._prev)}),$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:"),n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply()))},select:function(t){isSelect=!0;n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._old)});$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:");n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply());t.dataItem.IsHazmat&&($("#"+this.element.attr("id")).parent().parent().siblings("label").children().length||$("#"+this.element.attr("id")).parent().parent().siblings("label").append('    HAZMAT<\/span>'),n.hazmatParts.length>0&&n.hazmatParts.indexOf(t.dataItem.PartNumber)!==-1||n.hazmatParts.push(t.dataItem.PartNumber),n.data.shipment.IsHazmat=!0,n.$apply())}}))},function(t){n.loadingPartDetails=!1;nt(t)})},ht=function(t){n.data.modeTypes=t&&t.ModeTypes?t.ModeTypes:[]},ct=function(){n.data.shipment.DepartmentCode=null;switch(n.data.shipment.ModeGroupId){case n.MODE_GROUP_AIR_CHARTER:n.data.shipment.Schedule&&(n.data.shipment.Schedule=null);break;case n.MODE_GROUP_UNKNOWN:n.data.shipment.IsExportedAsProject=!1;n.data.modePermissions.ExpediteHomeToPlant&&(n.data.shipment.OriginalShipperLocationId=n.data.shipment.CallerLocationId,_.head(n.data.shipment.Stops).LocationId=n.data.shipment.CallerLocationId);n.data.modePermissions.ExpeditePlantToHome&&(n.data.shipment.FinalConsigneeLocationId=n.data.shipment.CallerLocationId,_.last(n.data.shipment.Stops).LocationId=n.data.shipment.CallerLocationId)}},g=function(n){var t=Math.floor(n/60),i=n%60;return(t>0?t+"h ":"")+(i>0?i+"m":"")},wt=function(){return n.data.shipment.Stops[0].LocationId?n.data.shipment.Stops[n.data.shipment.Stops.length-1].LocationId?n.data.shipment.CustomerId?n.data.shipment.ReadyDateTime?!0:!1:!1:!1:!1},bt=function(){n.data.shipment.TeamService=!0},ft=function(){n.payorCanBeDetermined&&(n.loadingPremiumCodes=!0,s.getPremiumCodes(n.data.shipment,function(){n.loadingPremiumCodes=!1;n.data.premiumCodes=s.premiumCodes},function(t){n.loadingPremiumCodes=!1;nt(t)}),s.getPaymentTerms(n.data.shipment,function(t){n.paymentResults=t;_.each(t.ThirdPartyPayorLocations,function(n){_.isEmpty(n.Code)||(n.Name=n.Code+" - "+n.Name)});n.data.shipment.PayorLocations=t.ThirdPartyPayorLocations;n.paymentTermsList=n.data.paymentTermsList;t.AllowCollectTerms||(n.paymentTermsList=n.paymentTermsList.filter(function(t){return t.Id!==n.PAYMENT_TERMS_COLLECT}));t.AllowPrepaidTerms||n.data.shipment.CustomerId===n.CUSTOMER_GENERAL_MOTORS||(n.paymentTermsList=n.paymentTermsList.filter(function(t){return t.Id!==n.PAYMENT_TERMS_PREPAID}));t.AllowThirdPartyTerms||(n.paymentTermsList=n.paymentTermsList.filter(function(t){return t.Id!==n.PAYMENT_TERMS_THIRD_PARTY}));t.DefaultPaymentTermsId>0&&(n.data.shipment.PaymentTermsId=t.DefaultPaymentTermsId);t.DefaultPayorLocationId&&(n.data.shipment.PayorLocationId=t.DefaultPayorLocationId)},function(n){nt(n)}))},lt=function(){n.loadingModeGroups=!0;s.getCustomerModeGroups(n.customer,function(t){n.loadingModeGroups=!1;n.data.modeGroups=t.ModeGroups;n.data.customerRules=t.CustomerRules;n.data.modePermissions=t;n.loadingCustomer=!0;h.getCustomerById(n.customer,function(t){n.loadingCustomer=!1;n.customerName=t?t.Name:null});n.setDriveTime();n.loadingIncoterms=!0;y.getIncoterms(n.data.shipment.CustomerId,function(){n.loadingIncoterms=!1;n.data.Incoterms=y.Incoterms},function(t){n.loadingIncoterms=!1;nt(t)});n.data.customerRules&&!n.data.customerRules.IsContainerParticipant&&(n.data.modeGroups=_.filter(t.ModeGroups,function(n){return n.Name!=="Container"}));a.getCustomQualifiers(n.data.shipment.CustomerId,function(t){t?.length>0&&(n.data.customQualifierData=t)},function(n){nt(n)});n.data.customerRules&&n.data.customerRules.IsCostAllocationEnabled&&s.getCustomerPlantList(n.data.shipment.CustomerId,function(t){n.data.customerPlants=t},function(n){nt(n)});n.loadingFailureReasons=!0;b.getFailureReasons(n.data.shipment.CustomerId,n.data.shipment.CallerLocationId,function(t){n.loadingFailureReasons=!1;n.data.failureReasons=t},function(t){n.loadingFailureReasons=!1;nt(t)});n.data.customerRules&&(n.isAddressbookCapabilityEnabled=n.data.customerRules.IsAddressbookCapabilityEnabled,n.IsAddNewAddressbookLocationCapabilityEnabled=n.data.customerRules.IsAddNewAddressbookLocationCapabilityEnabled,n.data.shipment.IsAutoExport=n.data.customerRules.AutoExportDefaultValue,n.data.shipment.IsAutoAward=n.data.customerRules.AutoAwardDefaultValue)},function(t){n.loadingModeGroups=!1;nt(t)})},kt=function(){if(n.data.allowBlueYonder=!1,t.isAdmin||t.isSuperAdmin){n.data.allowBlueYonder=!0;return}n.data.userLocationTypes.forEach(t=>{if(t.CustomerId===n.CUSTOMER_FORD_MOTOR&&t.LocationType==="Corporate"){n.data.allowBlueYonder=!0;return}})};rt()}]);xpoNlmModule.controller("CustomerOrderEntrySuccessModalInstanceController",["$rootScope","$scope","$uibModalInstance","$uibModal","$window","orderEntryData","id","isProject",function(n,t,i,r,u,f,e,o){t.orderEntryData=f;t.id=e;t.date=new Date;t.idType=o?"Project":"Shipment";t.OpenDetails=function(i){var r;if(o)r=t.id;else if(i)r=i;else if(t.id[0])r=t.id[0];else return;o?u.open("/admin/admUPMAuctionDetails.asp?PrjId="+r,"ProjectDetails","width=650px,height=550px,scrollbars=yes,toolbar=0,menubar=1,resizable=1"):u.open(n.ServerName+n.WebClientPath+"/#/ShipmentDetails/"+r,"ShipmentDetails","width=650px,height=550px,scrollbars=yes,toolbar=0,menubar=1,resizable=1")};t.CreateNew=function(){i.close(!0)};t.Cancel=function(){i.dismiss("cancel")};t.openDocUploadModal=function(t){r.open({templateUrl:n.WebClientPath+"/Modules/XpoNlm/Common/Views/DocumentUploadModal.html",controller:"DocumentUploadModalInstanceController",resolve:{recordId:function(){return t},recordType:function(){return"Shipment"}},windowClass:"modal-window-large mt-expedite-legacy",backdrop:"static",keyboard:!1})}}]);xpoNlmModule.controller("OrderEntryController",["$scope","$rootScope","$uibModal","$window","$timeout","appAddressDataService","orderEntryData","orderEntryService","customerData","vehicleListService","commoditiesService","customQualifierService","mileageService","shipmentService","modalService","specializedService","modeGroupsService","customersService","userLocationTypeService","locationGroupService",function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d){n.CUSTOMER_FORD_MOTOR=1;n.CUSTOMER_FORD_POWERTRAIN=23;n.CUSTOMER_GENERAL_MOTORS=3;n.CUSTOMER_STELLANTIS=4;n.PAYMENT_TERMS_PREPAID=2;n.PAYMENT_TERMS_COLLECT=3;n.PAYMENT_TERMS_THIRD_PARTY=4;n.MODE_GROUP_UNKNOWN=-1;n.MODE_GROUP_EXPEDITE=-1;n.MODE_GROUP_GROUND_EXPEDITE=1;n.MODE_GROUP_TRUCKLOAD=2;n.MODE_GROUP_AIR=3;n.MODE_GROUP_AIR_CHARTER=4;n.MODE_GROUP_CONTAINER=9;n.MODE_GROUP_INTERNATIONAL=10;n.MODE_GROUP_SPECIALIZED=7;n.MODE_TYPE_SHORT_TERM_DEDICATED=62;n.PARTNUMBER_AUTOCOMPLETE_COMBOBOX=20;n.SCHEDULE_ENTRY_FREQUENCY_EVERY=2;n.SCHEDULE_ENTRY_FREQUENCY_CALENDAR=3;n.BLUE_YONDER_GROUP_ID=241;n.departmentCodeValidated=!0;n.wbsValidated=!0;n.aetcValidated=!0;n.backhaulAetcValidated=!0;n.data=e;n.addressData=f;n.firstTimeDeterminedCustomer=!0;n.$watch("initialForm.$dirty",function(){n.initialForm.$dirty&&u(function(){ot(n.contentForm)})});n.$watchCollection("initialForm.$error",function(t){n.editMode=!t||!Object.keys(t).length});n.$watchGroup(["data.shipment.CustomerId","data.shipment.ModeGroupId"],function(){if(!n.data.shipment.CustomerId){n.data.commodities=[];return}k.getLocationTypes(function(){n.data.userLocationTypes=k.LocationTypes;ni();n.data.allowBlueYonder||d.getLocationGroupMembers(n.BLUE_YONDER_GROUP_ID).then(function({data:t}){n.data.restrictedLocationIds=t.map(n=>n.LocationId)})},function(n){nt(n)});n.data.shipment.ModeGroupId&&n.data.shipment.CustomerId?(n.loadingCommodities=!0,c.getCommodities(n.data.shipment.CustomerId,n.data.shipment.ModeGroupId,function(){n.loadingCommodities=!1;n.data.commodities=c.Commodities},function(t){n.loadingCommodities=!1;nt(t)}),n.loadingVehicleTypes=!0,h.getVehicleList(n.data.shipment.CustomerId,n.data.shipment.ModeGroupId,function(){n.loadingVehicleTypes=!1;n.data.vehicleTypes=h.vehicleList},function(t){n.loadingVehicleTypes=!1;nt(t)})):n.data.vehicleTypes=null});n.$watch("data.shipment.ModeTypeId",function(){n.data.modeTypes&&(n.data.modeTypes=n.data.shipment.ModeTypeId===n.MODE_TYPE_SHORT_TERM_DEDICATED?n.data.modeTypes.concat({Id:n.MODE_TYPE_SHORT_TERM_DEDICATED,Name:"S-T Ded"}):n.data.modeTypes.filter(t=>t.Id!==n.MODE_TYPE_SHORT_TERM_DEDICATED))});n.$watchGroup(["data.shipment.CommodityId","data.shipment.CustomerId","data.shipment.ModeGroupId"],function(){n.data.shipment.CommodityForFord=(n.data.shipment.CommodityId===1||n.data.shipment.CommodityId===2||n.data.shipment.CommodityId===4)&&(n.data.shipment.CustomerId===n.CUSTOMER_FORD_MOTOR||n.data.shipment.CustomerId===n.CUSTOMER_FORD_POWERTRAIN)&&(n.data.shipment.ModeGroupId===n.MODE_GROUP_UNKNOWN||n.data.shipment.ModeGroupId===n.MODE_GROUP_TRUCKLOAD)});n.loadingCustomers=!0;b.getCustomers(function(){n.loadingCustomers=!1;b.customers.length&&(n.customers=b.customers.sort((n,t)=>n.Name>t.Name?1:-1))},function(t){n.loadingCustomers=!1;nt(t)});n.loadingModeGroups=!0;w.getModeGroupsWithFilter("OE",function(){n.loadingModeGroups=!1;n.data.modeGroups=w.modeGroups},function(t){n.loadingModeGroups=!1;nt(t)});n.loadingNoteTypes=!0;o.getNoteTypes(function(){n.loadingNoteTypes=!1;n.data.noteTypes=o.noteTypes;n.data.defaultNoteTypeId=_.find(o.noteTypes,function(n){return n.NtpType==="Trip"}).NtpId;st()},function(t){n.loadingNoteTypes=!1;nt(t)});n.cloneSuccessCallback=function(){n.clonedShipment=!0;n.initialForm.$setDirty();n.data.shipment=angular.copy(o.shipment);n.data.shipment.Stops&&n.data.shipment.Stops[0].LocationCode!==null&&(n.stopOrigin=n.data.shipment.Stops[0],n.data.shipment.Stops[0].LocationId===n.data.shipment.OriginalShipperLocationId&&(n.sameAsOrigin=!0));n.data.shipment.Stops&&n.data.shipment.Stops[1].LocationCode!==null&&(n.stopDestination=n.data.shipment.Stops[1],n.data.shipment.Stops[1].LocationId===n.data.shipment.FinalConsigneeLocationId&&(n.sameAsDestination=!0));n.data.shipment.ModeGroupId===n.MODE_GROUP_SPECIALIZED&&n.data.shipment.Dimensions.forEach(function(n){var t=p.convertInchesToFeet(n.Length),i=p.convertInchesToFeet(n.Width),r=p.convertInchesToFeet(n.Height);n.LengthFeet=t[0];n.WidthFeet=i[0];n.HeightFeet=r[0];n.LengthInches=t[1];n.WidthInches=i[1];n.HeightInches=r[1]});ut();u(function(){ct();rt()?it():tt()})};n.restart=function(){y.openMessageModal("Restarting this form will erase any work you may have done. Are you sure you want to continue?","warning",ht)};n.review=function(t){if(!t.$valid){console.error(t);return}if(n.data.shipment.Stops.length>0){n.validationErrors=[];n.contentForm.$setPristine();var i=!0;if(angular.forEach(n.data.shipment.Stops,function(t){t.StopType===0&&(n.validationErrors=[],n.validationErrors.push("Stop type [Pickup/Delivery/Mex Border] is required for Intermediate Stops"),i=!1)}),!i){n.reviewing=!1;return}}if(n.reviewed){n.reviewed=!1;n.editMode=!0;return}n.contentForm.$setPristine();n.data.shipment.CustomerId===n.CUSTOMER_FORD_MOTOR||n.data.shipment.CustomerId===n.CUSTOMER_FORD_POWERTRAIN||n.data.shipment.ModeGroupId!==n.MODE_GROUP_TRUCKLOAD||(n.data.shipment.OriginalShipperLocationCode=null,n.data.shipment.FinalConsigneeLocationCode=null);n.data.shipment.ModeGroupId===n.MODE_GROUP_SPECIALIZED&&n.data.shipment.Dimensions.forEach(function(n){n.Length=p.convertFeetToInches(n.LengthFeet,n.LengthInches);n.Width=p.convertFeetToInches(n.WidthFeet,n.WidthInches);n.Height=p.convertFeetToInches(n.HeightFeet,n.HeightInches)});n.validationErrors=null;n.validationWarning=null;n.reviewing=!0;o.validateShipment(n.data.shipment,function(t){n.reviewing=!1;n.validationWarning=t.Warnings.join("; ");n.editMode=!1;n.reviewed=!0;$("html,body").animate({scrollTop:0},"slow")},function(t){n.reviewing=!1;n.validationErrors=t.Errors||[t.ExceptionMessage]})};n.submitOrder=function(){n.submitting=!0;o.insertShipment(n.data.shipment,n.originCountryCode,n.destinationCountryCode,function(t){n.submitting=!1;kt(t)},function(t){n.submitting=!1;nt(t)})};n.customerChanged=function(){tt();n.data.shipment.CustomerId=n.customer;n.loadingCustomer=!0;s.getCustomerById(n.data.shipment.CustomerId,function(t){n.loadingCustomer=!1;n.customerName=t?t.Name:null});n.data.shipment.CustomerId===n.CUSTOMER_STELLANTIS&&(n.data.modeGroups=_.filter(w.modeGroups,function(t){return t.Id===n.MODE_GROUP_EXPEDITE||t.Id===n.MODE_GROUP_AIR_CHARTER||t.Id===n.MODE_GROUP_SPECIALIZED||t.Id===-999}));n.data.shipment.CustomerId!==n.CUSTOMER_FORD_MOTOR&&n.data.shipment.CustomerId!==n.CUSTOMER_FORD_POWERTRAIN&&(n.data.shipment.DepartmentCode=null)};n.modeGroupIdChanged=function(){at();n.data.shipment.DepartmentCode=null;lt(_.find(n.data.modeGroups,{Id:n.data.shipment.ModeGroupId}));n.data.shipment.ModeTypeId=n.data.modeTypes&&n.data.modeTypes.length===1?n.data.modeTypes[0].Id:null;st();n.data.shipment.ModeGroupId&&n.data.shipment.ModeGroupId===n.MODE_GROUP_TRUCKLOAD?n.data.shipment.PremiumCodeId=null:n.data.shipment.ProjectDeviationReasonCodeId=null};n.modeTypeIdChanged=function(){at()};n.onDepartmentCodeChange=function(){n.departmentCodeValidated=n.data.shipment.DepartmentCode.length>0?!1:!0};n.onWbsChange=function(){n.wbsValidated=!1};n.onAetcChange=function(){n.aetcValidated=!1};n.onCriticalChange=function(){n.data.shipment.ShutdownDateTime=null};n.onBackhaulAetcChange=function(){n.backhaulAetcValidated=!1};n.paymentTermsIdChanged=function(){gt();n.data.shipment.PremiumCodeId=null;n.data.shipment.ProjectDeviationReasonCodeId=null};n.vehicleChanged=function(t){var i=n.data?.vehicleTypes?.find(n=>n.Id===t);i?.AutoSelectTarpsOnSpecializedShipments&&(n.data.shipment.Tarps=!0)};n.stopLocationIdChanged=function(t,i,r){i?(n.sameAsOrigin=null,n.data.shipment.Stops[0].LocationCode=n.selectedLocationCode,n.data.shipment.Stops[0].LocationType=n.selectedLocationType,n.data.shipment.OriginalShipperLocationId=t.LocationId,n.data.shipment.PayorLocationId=null,n.originCountryCode=n.selectedLocationCountry):r&&(n.sameAsDestination=null,n.data.shipment.Stops[1].LocationCode=n.selectedLocationCode,n.data.shipment.Stops[1].LocationType=n.selectedLocationType,n.data.shipment.FinalConsigneeLocationId=t.LocationId,n.data.shipment.PayorLocationId=null,n.destinationCountryCode=n.selectedLocationCountry);vt();rt()?it():tt();n.partAutocompleteDataSource=null;n.partDropdownDataSource=null;t.CloseTime=null;n.setDriveTime();n.calculateCloseTime()};n.originalShipperLocationIdChanged=function(){n.data.shipment.PayorLocationId=null;rt()?it():tt();n.sameAsOrigin=!1;n.data.shipment.OriginalShipperLocationId?(n.data.shipment.OriginalShipperLocationCode=n.selectedLocationCode,n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null&&(n.loadingPartDetails=!0,ut())):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.finalConsigneeLocationIdChanged=function(){n.data.shipment.PayorLocationId=null;rt()?it():tt();n.sameAsDestination=!1;n.data.shipment.FinalConsigneeLocationId?(n.data.shipment.FinalConsigneeLocationCode=n.selectedLocationCode,n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null&&(n.loadingPartDetails=!0,ut())):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.payorLocationIdChanged=function(){n.data.shipment.PayorLocationId>0&&n.data.shipment.PaymentTermsId!==n.PAYMENT_TERMS_PREPAID&&n.data.shipment.PaymentTermsId!==n.PAYMENT_TERMS_COLLECT&&rt()?it():tt()};n.sameAsOriginCheckboxChange=function(){n.data.shipment.OriginalShipperLocationId=n.sameAsOrigin?null:n.stopOrigin.LocationId;n.data.shipment.OriginalShipperLocationCode=n.sameAsOrigin?null:n.stopOrigin.LocationCode;n.data.shipment.PayorLocationId=null;n.data.shipment.CarrierId=null;rt()?it():tt();n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null?(n.loadingPartDetails=!0,ut()):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.sameAsDestinationCheckboxChange=function(){n.data.shipment.FinalConsigneeLocationId=n.sameAsDestination?null:n.stopDestination.LocationId;n.data.shipment.FinalConsigneeLocationCode=n.sameAsDestination?null:n.stopDestination.LocationCode;n.partAutocompleteDataSource=null;n.partDropdownDataSource=null;n.data.shipment.PayorLocationId=null;n.data.shipment.CarrierId=null;rt()?it():tt();n.data.shipment.OriginalShipperLocationCode!==null&&n.data.shipment.FinalConsigneeLocationCode!==null?(n.loadingPartDetails=!0,ut()):(n.partAutocompleteDataSource=null,n.partDropdownDataSource=null)};n.setDriveTime=function(){if(!dt()){n.driveTime=null;n.calculatedArrivalTime=null;n.additionalMileageInfo=null;return}n.loadingMileage=!0;a.getMileage(n.data.shipment.Stops.map(n=>n.LocationId),n.data.shipment.CustomerId,n.data.shipment.ReadyDateTime,n.data.shipment.IsHazmat,function(t){if(n.loadingMileage=!1,t&&(t.TransitTimeInMinutes||t.TotalTransitTimeInMinutes)){n.driveTime=g(t.TransitTimeInMinutes)+" ("+t.Mileage+" miles)";n.calculatedArrivalTime=moment(t.CalculatedArrivalDateTime).format("MM/DD/YYYY HH:mm");n.data.shipment.calculatedArrivalTime=n.calculatedArrivalTime;t.AirDeliveryTime":"",i+=t.NonMXDriveTimeInMinutes?"Drive Time Non-MX: "+g(t.NonMXDriveTimeInMinutes)+"
":"",i+=t.MXMilesPerHour?"Speed MX: "+t.MXMilesPerHour+" mph
":"",i+=t.MXDriveTimeInMinutes?"Drive Time MX: "+g(t.MXDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.MexicoBorderCrossingTimeInMinutes?"Border Crossing: "+g(t.MexicoBorderCrossingTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.MXBorderLoadTime?"Border Load Time: "+g(t.MXBorderLoadTime)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":""):n.data.shipment.CustomerId===n.CUSTOMER_STELLANTIS&&n.IsIntraMexico?(i+=t.MilesPerHour?"Speed: "+t.MXMilesPerHour+" mph
":"",i+=t.TotalDriveTimeInMinutes?"Drive Time: "+g(t.TotalDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":""):n.data.shipment.IsDirectTransit?(i+=t.MilesPerHour?"Speed: "+t.MilesPerHour+" mph
":"",i+=t.TotalDriveTimeInMinutes?"Drive Time: "+g(t.TotalDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.CanadaBorderCrossingTimeInMinutes?"Border Crossing: "+g(t.CanadaBorderCrossingTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":"",n.data.shipment.calculatedArrivalTime=n.calculatedArrivalTime,n.data.shipment.ProtectDateTime=n.calculatedArrivalTime):(i+=t.MilesPerHour?"Speed: "+t.MilesPerHour+" mph
":"",i+=t.TotalDriveTimeInMinutes?"Drive Time: "+g(t.TotalDriveTimeInMinutes)+"
":"",i+=t.LoadTimeInMinutes?"Load Time: "+g(t.LoadTimeInMinutes)+"
":"",i+=t.CanadaBorderCrossingTimeInMinutes?"Border Crossing: "+g(t.CanadaBorderCrossingTimeInMinutes)+"
":"",i+=t.InPositionMinutes?"In Position: "+g(t.InPositionMinutes)+"
":"",i+=t.CoverageTime?"Coverage Time: "+g(t.CoverageTime)+"
":"");n.additionalMileageInfo=i.length>0?i:null;$("#mileageInfo").data("kendoTooltip")&&$("#mileageInfo").data("kendoTooltip").destroy();$("#mileageInfo").kendoTooltip({filter:"span",position:"top",content:function(){return n.additionalMileageInfo}}).data("kendoTooltip")}},function(t){n.loadingMileage=!1;nt(t)})};n.calculateCloseTime=function(){let t=new Date(n.data.shipment.ReadyDateTime).getDay(),i=new Date(n.data.shipment.ProtectDateTime).getDay();n.data.shipment.Stops.forEach(r=>{var u;isNaN(t)||r.Sequence==1&&(u=function(n){n?.DaysOfWeek&&!n?.DaysOfWeek?.every(n=>n.LocSchId===0)&&(r.CloseTime=n.DaysOfWeek[t].CloseTimestr?.slice(0,5),r.OpenTime=n.DaysOfWeek[t].OpenTimestr?.slice(0,5),r.CloseTime=="00:00"&&r.OpenTime=="00:00"&&(r.IsClosedToday=!0),r.Is24Hour=n.DaysOfWeek[t].Is24Hour,r.EnforceHour=n.EnforceHour,r.ShowOverride=n.EnforceHour?!0:!1)},n.addressData.getLocation(r.LocationId,u));isNaN(i)||r.Sequence==Math.max(...n.data.shipment.Stops.map(n=>n.Sequence))&&(u=function(n){n?.DaysOfWeek&&!n?.DaysOfWeek?.every(n=>n.LocSchId===0)&&(r.CloseTime=n.DaysOfWeek[i].CloseTimestr?.slice(0,5),r.OpenTime=n.DaysOfWeek[i].OpenTimestr?.slice(0,5),r.CloseTime=="00:00"&&r.OpenTime=="00:00"&&(r.IsClosedToday=!0),r.Is24Hour=n.DaysOfWeek[i].Is24Hour,r.EnforceHour=n.EnforceHour,r.ShowOverride=n.EnforceHour?!0:!1)},n.addressData.getLocation(r.LocationId,u))})};n.validateDepartmentCode=function(){o.validateDepartmentCode(n.data.shipment.DepartmentCode,function(t){t?.Errors?.length?(n.departmentCodeValidated=!1,nt(t)):n.departmentCodeValidated=!0},function(t){n.departmentCodeValidated=!1;nt(t)})};n.validateWbs=function(){o.validateWBS(n.data.shipment.WBSNumber,function(t){t?.Errors?.length?(n.wbsValidated=!1,nt(t)):n.wbsValidated=!0},function(t){n.wbsValidated=!1;nt(t)})};n.validateAETC=function(){if(n.data.shipment.AuthorizationCode==="9999"){n.aetcValidated=!0;return}o.validateAETC(n.data.shipment.AuthorizationCode,n.customer,function(t){pt(t);n.aetcValidated=!0},function(t){n.aetcValidated=!1;nt(t)})};n.validateBackhaulAetc=function(){if(n.data.shipment.BackhaulAetcCode==="9999"){n.backhaulAetcValidated=!0;return}o.validateAETC(n.data.shipment.BackhaulAetcCode,n.customer,function(){n.backhaulAetcValidated=!0},function(t){n.backhaulAetcValidated=!1;nt(t)})};Object.defineProperty(n,"carrierCanBeDetermined",{get:function(){return n.data&&n.data.shipment&&n.data.shipment.ModeGroupId&&n.data.shipment.Stops[0].LocationId&&n.data.shipment.Stops[n.data.shipment.Stops.length-1].LocationId&&n.data.shipment.CustomerId}});n.$watchGroup(["data.shipment.Stops[0].LocationId","data.shipment.Stops[data.shipment.Stops.length - 1].LocationId","data.shipment.ModeGroupId","data.shipment.ProtectDateTime"],function(){n.carrierCanBeDetermined&&(wt(),bt())});n.isExceptionChanged=function(){n.data.shipment.CustomerId>0&&(n.loadingPremiumCodes=!0,n.premiumCodesError=undefined,o.getPremiumCodes(n.data.shipment,function(){n.loadingPremiumCodes=!1;n.data.premiumCodes=o.premiumCodes;n.data.shipment.PremiumCodeId=null},function(t){n.loadingPremiumCodes=!1;n.premiumCodesError=t.ExceptionMessage||t.Message}))};n.callerLocationIdChanged=function(){n.data.shipment.CallerLocationId&&(n.data.shipment.Stops[0].LocationId||(n.data.shipment.ModeGroupId!=n.MODE_GROUP_SPECIALIZED&&(n.data.shipment.Stops[0].LocationId=n.data.shipment.CallerLocationId,n.data.shipment.Stops[0].LocationCode=n.selectedLocationCode,n.data.shipment.Stops[0].LocationType=n.selectedLocationType),n.data.shipment.OriginalShipperLocationId=n.data.shipment.CallerLocationId,n.originCountryCode=n.selectedLocationCountry,vt()),n.routeForm.$setDirty(),n.data.shipment.PayorLocationId=null,n.billingForm.$setDirty(),rt()?it():tt())};n.callerContactIdChanged=function(){if(n.data.shipment.CallerContactId){var t=_.first(n.data.shipment.Stops);t&&(!t.ContactId||t.ContactId===-999)&&(t.ContactId=n.data.shipment.CallerContactId)}};n.specializedDetermineCustomer=function(){n.loadingCustomer=!0;o.determineCustomer(n.data.shipment,function(t){n.loadingCustomer=!1;n.data.customerDeterminationResults=t;n.data.customerDeterminationResults?.DefaultPayorLocationId&&(n.data.shipment.PayorLocationId=n.data.customerDeterminationResults?.DefaultPayorLocationId);n.data.customerDeterminationResults?.DefaultPaymentTerms>0&&(n.data.shipment.PaymentTermsId=n.data.customerDeterminationResults?.DefaultPaymentTerms)},function(t){n.loadingCustomer=!1;tt();t.Message&&n.customerDeterminationErrors.push(t.Message);t.ExceptionMessage&&n.customerDeterminationErrors.push(t.ExceptionMessage);t.OutputMessage&&n.customerDeterminationErrors.push(t.OutputMessage);n.data.customerDeterminationResults=t})};var ot=function(n){n.$$controls!==undefined&&n.$$controls.forEach(n=>{ot(n)});n.$setTouched!==undefined&&n.$setTouched()},et={NtpId:54,NtpType:"Project"},st=function(){n.data?.shipment?.ModeGroupId&&n.data.shipment.ModeGroupId===n.MODE_GROUP_TRUCKLOAD?_.findIndex(o.noteTypes,et)===-1&&n.data.noteTypes.push(et):(_.remove(n.data.noteTypes,et),n.data.shipment&&n.data.shipment.Notes&&_.remove(n.data.shipment.Notes,function(n){return n.NoteType===et.NtpId}));n.data.defaultNoteTypeId&&(n.data.noteType=n.data.defaultNoteTypeId)},pt=function(t){n.callerForm.$setDirty();n.routeForm.$setDirty();n.billingForm.$setDirty();n.shipmentForm.$setDirty();n.data.shipment.Stops[0].LocationId=t.OriginLocationId;n.data.shipment.Stops[1].LocationId=t.DestinationLocationId;n.data.shipment.OriginalShipperLocationId=t.SupplierLocationId;n.data.shipment.FinalConsigneeLocationId=t.DestinationLocationId;n.data.shipment.IsHazmat=t.PartIsHazmat;n.data.shipment.PremiumCodeId=t.PremiumCodeId;n.originCountryCode=t.OriginCountryCode;n.destinationCountryCode=t.DestinationCountryCode;n.data.shipment.MexicoCrossBorderProgram=t.DestinationCountryCode==="MX"&&t.OriginCountryCode!=="MX"||t.OriginCountryCode==="MX"&&t.DestinationCountryCode!=="MX";n.IsIntraMexico=t.DestinationCountryCode==="MX"&&t.OriginCountryCode==="MX"},ct=function(){n.contentForm.$setPristine();n.contentForm.$setUntouched();n.data.shipment.IsCustomerOE=!1;lt(_.find(n.data.modeGroups,{Id:n.data.shipment.ModeGroupId}));st()},wt=function(){n.carrierCanBeDetermined&&o.getEligibleCarrierResults(n.data.shipment,function(t){n.preferredCarriers=_.size(t)>0?t:null},function(n){console.error(n)})},bt=function(){n.carrierCanBeDetermined&&o.getTruckloadFailingCarrierList(n.data.shipment.CustomerId,function(t){n.failingCarriers=_.size(t)>0?t.map(n=>({Id:n.SCAC,Name:n.Name})):null},function(n){console.error(n)})},ht=function(){n.editMode=!1;n.reviewed=!1;n.wbsValidated=!0;n.aetcValidated=!0;n.backhaulAetcValidated=!0;n.data.shipment=null;n.stopOrigin=null;n.stopDestination=null;n.sameAsDestination=null;n.sameAsOrigin=null;n.customer=null;n.cloneData=null;n.customerName=null;n.firstTimeDeterminedCustomer=!0;n.clonedShipment=!1;n.validationErrors=null;n.validationWarning=null;n.data.shipment={NumberOfShipments:1,Stops:[{StopType:1,Sequence:1},{StopType:2,Sequence:2}]};u(function(){ct()})},kt=function(n){var r,u,f;n.ProjectId?(r=n.ProjectId,u=!0):(r=n.ShipmentIds,u=!1);f=i.open({templateUrl:t.WebClientPath+"/Modules/XpoNlm/OrderEntry/Views/SuccessModal.html",controller:"OrderEntrySuccessModalInstanceController",resolve:{id:function(){return r},isProject:function(){return u}},windowClass:"order-Entry-Success-Modal mt-expedite-legacy"});f.result.then(function(n){n&&ht()},angular.noop)},nt=function(n){var t=[];n.Message&&t.push(n.Message);n.ExceptionMessage&&t.push(n.ExceptionMessage);n.Errors&&(t=_.union(t,n.Errors));y.openMessageListModal(t,"error")},ut=function(){n.partDropdownDataSource=null;n.partAutocompleteDataSource=null;n.loadingPartDetails=!0;o.getParts(n.data.shipment.OriginalShipperLocationCode,n.data.shipment.FinalConsigneeLocationCode,function(t){n.loadingPartDetails=!1;n.hazmatParts=[];r.isSelect=!1;r.previousValue="";t!==null&&(t.length>n.PARTNUMBER_AUTOCOMPLETE_COMBOBOX?(n.partDropdownDataSource=null,n.partAutocompleteDataSource={dataTextField:"PartNumber",dataValueField:"PartNumber",dataSource:t,minLength:3,template:'

#:data.PartNumber#<\/span>*<\/span>

Desc: #:data.Description#<\/font><\/p><\/div>',filter:"contains",dataBound:function(n){var t=n.sender._prev,i=n.sender.ul.children();i.length>0&&t.length>2&&$(i).find("span.partName").each(function(n,i){var r=$(i).text(),u=""+r.substr(r.toLowerCase().indexOf(t.toLowerCase()),t.length)+"<\/strong>";i.innerHTML=r.replace(r.substr(r.toLowerCase().indexOf(t.toLowerCase()),t.length),u)})},close:function(){isSelect=!1},change:function(t){isSelect||(n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._prev)}),$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:"),n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply()))},select:function(t){isSelect=!0;n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._old)});$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:");n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply());t.dataItem.IsHazmat?($("#"+this.element.attr("id")).parent().parent().siblings("label").children().length||$("#"+this.element.attr("id")).parent().parent().siblings("label").append('    HAZMAT<\/span>'),n.data.shipment.IsHazmat=!0,n.hazmatParts.length>0&&n.hazmatParts.indexOf(t.dataItem.PartNumber)!==-1||n.hazmatParts.push(t.dataItem.PartNumber),n.$apply()):$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:")}}):t.length<=n.PARTNUMBER_AUTOCOMPLETE_COMBOBOX&&t.length>0&&(n.partAutocompleteDataSource=null,n.partDropdownDataSource={dataTextField:"PartNumber",dataValueField:"PartNumber",dataSource:t,optionLabel:"Select a Part",clearButton:!1,ValuePrimitive:!0,template:'

#:data.PartNumber#<\/span>*<\/span>

Desc: #:data.Description#<\/font><\/p><\/div>',close:function(){isSelect=!1},open:function(n){previousValue=n.sender._inputWrapper[0].textContent},change:function(t){isSelect||(n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._prev)}),$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:"),n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply()))},select:function(t){isSelect=!0;n.hazmatParts=_.filter(n.hazmatParts,function(n){return!(n===t.sender._old)});$("#"+this.element.attr("id")).parent().parent().siblings("label").html("Part #:");n.hazmatParts.length===0&&(n.data.shipment.IsHazmat=!1,n.$apply());t.dataItem.IsHazmat&&($("#"+this.element.attr("id")).parent().parent().siblings("label").children().length||$("#"+this.element.attr("id")).parent().parent().siblings("label").append('    HAZMAT<\/span>'),n.hazmatParts.length>0&&n.hazmatParts.indexOf(t.dataItem.PartNumber)!==-1||n.hazmatParts.push(t.dataItem.PartNumber),n.data.shipment.IsHazmat=!0,n.$apply())}}))},function(t){n.loadingPartDetails=!1;nt(t)})},lt=function(t){n.data.modeTypes=t&&t.ModeTypes?t.ModeTypes:[]},at=function(){switch(n.data.shipment.ModeGroupId){case n.MODE_GROUP_AIR_CHARTER:n.data.shipment.Schedule&&(n.data.shipment.Schedule=null);break;case n.MODE_GROUP_UNKNOWN:n.data.shipment.IsExportedAsProject=!1}},g=function(n){var t=Math.floor(n/60),i=n%60;return(t>0?t+"h ":"")+(i>0?i+"m":"")},dt=function(){return n.data.shipment.Stops[0].LocationId?n.data.shipment.Stops[n.data.shipment.Stops.length-1].LocationId?n.data.shipment.CustomerId?n.data.shipment.ReadyDateTime?!0:!1:!1:!1:!1},vt=function(){n.originCountryCode!==null&&n.destinationCountryCode!==null&&(n.data.shipment.MexicoCrossBorderProgram=n.destinationCountryCode==="MX"&&n.originCountryCode!=="MX"||n.originCountryCode==="MX"&&n.destinationCountryCode!=="MX",n.IsIntraMexico=n.destinationCountryCode==="MX"&&n.originCountryCode==="MX")},it=function(){n.loadingCustomer=!0;o.determineCustomer(n.data.shipment,function(t){n.loadingCustomer=!1;n.customer=t.CustomerId;n.customerChanged();n.data.customerDeterminationResults=t;n.data.customerRules=t.CustomerRules;n.customerDeterminationErrors=[];ft();yt();u(function(){ot(n.contentForm)})},function(t){n.loadingCustomer=!1;n.data.shipment.CustomerId=null;tt();t.Message&&n.customerDeterminationErrors.push(t.Message);t.ExceptionMessage&&n.customerDeterminationErrors.push(t.ExceptionMessage);t.OutputMessage&&n.customerDeterminationErrors.push(t.OutputMessage);n.data.customerDeterminationResults=t;yt()})},gt=function(){ft();switch(n.data.shipment.PaymentTermsId){case n.PAYMENT_TERMS_PREPAID:n.data.customerDeterminationResults&&n.data.customerDeterminationResults?.PrepaidCustomerId&&(n.data.customerRules=n.data.customerDeterminationResults?.PrepaidCustomerRules,n.data.shipment.CustomerId=n.data.customerDeterminationResults?.PrepaidCustomerId,n.customerDeterminationErrors=[],ft());n.data.shipment.PayorLocationId=_.first(n.data.shipment.Stops).LocationId;break;case n.PAYMENT_TERMS_COLLECT:n.data.customerDeterminationResults&&n.data.customerDeterminationResults?.CollectCustomerId&&(n.data.customerRules=n.data.customerDeterminationResults?.CollectCustomerRules,n.data.shipment.CustomerId=n.data.customerDeterminationResults?.CollectCustomerId,n.customerDeterminationErrors=[],ft());n.data.shipment.PayorLocationId=_.last(n.data.shipment.Stops).LocationId;break;default:n.data.customerDeterminationResults&&n.data.customerDeterminationResults?.CustomerId&&(n.data.customerRules=n.data.customerDeterminationResults?.CustomerRules,n.data.shipment.CustomerId=n.data.customerDeterminationResults?.CustomerId,n.customerDeterminationErrors=[],ft());n.data.shipment.PayorLocationId=null}},ft=function(){n.setDriveTime();n.data.customerRules&&!n.data.customerRules.IsContainerParticipant&&(n.data.modeGroups=w.modeGroups.filter(function(n){return n.Name!=="Container"}));n.data.customerRules&&!n.data.customerRules.IsSpecializedParticipant&&(n.data.modeGroups=w.modeGroups.filter(function(n){return n.Name!=="Specialized"}));l.getCustomQualifiers(n.data.shipment.CustomerId,function(t){t?.length>0&&(n.data.customQualifierData=t)},function(n){nt(n)});n.data.customerRules&&n.data.customerRules.IsCostAllocationEnabled&&o.getCustomerPlantList(n.data.shipment.CustomerId,function(t){n.data.customerPlants=t},function(n){nt(n)});n.data.customerRules&&(n.data.shipment.IsAutoExport=n.data.customerRules.AutoExportDefaultValue,n.data.shipment.IsAutoAward=n.data.customerRules.AutoAwardDefaultValue);n.loadingPremiumCodes=!0;n.premiumCodesError=undefined;o.getPremiumCodes(n.data.shipment,function(){n.loadingPremiumCodes=!1;n.data.premiumCodes=o.premiumCodes},function(t){n.loadingPremiumCodes=!1;n.premiumCodesError=t.ExceptionMessage||t.Message});n.loadingFailureReasons=!0;b.getFailureReasons(n.data.shipment.CustomerId,n.data.shipment.CallerLocationId,function(t){n.loadingFailureReasons=!1;n.data.failureReasons=t},function(t){n.loadingFailureReasons=!1;nt(t)});n.data.customerDeterminationResults&&(n.paymentTermsList=angular.copy(n.data.paymentTermsList),n.data.customerDeterminationResults?.AllowCollectTerms||(n.paymentTermsList=n.paymentTermsList.filter(function(n){return n.Name!=="Collect"})),n.data.customerDeterminationResults?.AllowPrepaidTerms||(n.paymentTermsList=n.paymentTermsList.filter(function(n){return n.Name!=="Prepaid"})),n.data.customerDeterminationResults?.AllowThirdPartyTerms||(n.paymentTermsList=n.paymentTermsList.filter(function(n){return n.Name!=="Third Party"})),n.data.customerDeterminationResults?.DefaultPayorLocationId&&!n.data.shipment.PayorLocationId&&(n.data.shipment.PayorLocationId=n.data.customerDeterminationResults?.DefaultPayorLocationId),n.data.customerDeterminationResults?.DefaultPaymentTerms>0&&!n.data.shipment.PaymentTermsId&&(n.data.shipment.PaymentTermsId=n.data.customerDeterminationResults?.DefaultPaymentTerms));n.loadingIncoterms=!0;v.getIncoterms(n.data.shipment.CustomerId,function(){n.loadingIncoterms=!1;n.data.Incoterms=v.Incoterms},function(t){n.loadingIncoterms=!1;nt(t)})},yt=function(){var t,i;n.firstTimeDeterminedCustomer&&(n.data.customerDeterminationResults?.CustomerId===n.CUSTOMER_FORD_MOTOR||n.data.customerDeterminationResults?.CustomerId===n.CUSTOMER_FORD_POWERTRAIN)&&!n.clonedShipment&&(n.data.shipment.OriginalShipperLocationId=null,n.data.shipment.FinalConsigneeLocationId=null,n.customerDeterminationErrors=[]);n.firstTimeDeterminedCustomer=!1;t=_.first(n.data.shipment.Stops);t?(n.sameAsOrigin=t.LocationId===(n.stopOrigin&&n.stopOrigin.LocationId),n.stopOrigin=_.first(n.data.shipment.Stops)):(n.sameAsOrigin=null,n.stopOrigin=null);i=_.last(n.data.shipment.Stops);i?(n.sameAsDestination=i.LocationId===(n.stopDestination&&n.stopDestination.LocationId),n.stopDestination=_.last(n.data.shipment.Stops)):(n.sameAsDestination=null,n.stopDestination=null)},tt=function(){n.customerName=null;n.data.customerDeterminationResults=null;n.data.customerRules=null;n.customerDeterminationErrors=[];n.driveTime=null;n.calculatedArrivalTime=null;n.additionalMileageInfo=null;n.data.modeGroups=n.customer===n.CUSTOMER_STELLANTIS?_.filter(w.modeGroups,function(t){return t.Id===n.MODE_GROUP_EXPEDITE||t.Id===n.MODE_GROUP_AIR_CHARTER||t.Id===n.MODE_GROUP_SPECIALIZED||t.Id===-999}):w.modeGroups;n.data.customQualifierData=null;n.data.customerPlants=null;n.data.premiumCodes=null;n.data.failureReasons=null;n.paymentTermsList=angular.copy(n.data.paymentTermsList);n.data.shipment.SpecializedTaskId=null;n.data.shipment.SpecializedReleaseNumber=null;n.data.shipment.calculatedArrivalTime=null},rt=function(){return n.data.shipment.CallerLocationId?n.data.shipment.Stops[0].LocationId?n.data.shipment.Stops[n.data.shipment.Stops.length-1].LocationId?n.data.shipment.OriginalShipperLocationId?n.data.shipment.FinalConsigneeLocationId?!0:!1:!1:!1:!1:!1},ni=function(){if(n.data.allowBlueYonder=!1,t.isAdmin||t.isSuperAdmin){n.data.allowBlueYonder=!0;return}n.data.userLocationTypes.forEach(t=>{if(t.CustomerId===n.CUSTOMER_FORD_MOTOR&&t.LocationType==="Corporate"){n.data.allowBlueYonder=!0;return}})};ht()}]);xpoNlmModule.controller("OrderEntrySuccessModalInstanceController",["$rootScope","$scope","$uibModalInstance","$uibModal","$window","$location","orderEntryData","id","isProject",function(n,t,i,r,u,f,e,o,s){t.orderEntryData=e;t.id=o;t.date=new Date;t.idType=s?"Project":"Shipment";t.OpenDashboard=function(){i.dismiss("cancel");u.location.href=n.ServerName+"/admin/home.asp"};t.OpenDetails=function(n){var r;if(s)r=t.id;else if(n)r=n;else if(t.id[0])r=t.id[0];else return;i.close(!0);s?u.open("/admin/admUPMAuctionDetails.asp?PrjId="+r,"ProjectDetails","width=650px,height=550px,scrollbars=yes,toolbar=0,menubar=1,resizable=1"):window.open("/WebClient/EmptyNoMaps/#/admin-shipment/"+r,"_blank","height=900,width=1100,resizable=1,status=0,location=0,toolbar=0,menubar=0")};t.OpenExport=function(){if(s)i.dismiss("cancel"),f.path("/ProjectTracking");else{var n=t.id[0];i.close(!0);u.open("/admin/Shd.asp?ShdP=Console&ShpId="+n,"ShipmentConsole","width=800px,height=600px,scrollbars=yes,toolbar=0,menubar=1,resizable=1")}};t.OpenTracking=function(){i.dismiss("cancel");s?f.path("/ProjectTracking"):f.path("/dynamic-tracking")};t.CreateNew=function(){i.close(!0)};t.Cancel=function(){i.dismiss("cancel");u.location.href=n.ServerName+"/WebClient/#/admin-dashboard"};t.openDocUploadModal=function(t){r.open({templateUrl:n.WebClientPath+"/Modules/XpoNlm/Common/Views/DocumentUploadModal.html",controller:"DocumentUploadModalInstanceController",resolve:{recordId:function(){return t},recordType:function(){return"Shipment"}},windowClass:"modal-window-large mt-expedite-legacy",backdrop:"static",keyboard:!1})}},]);xpoNlmModule.controller("PayAndInvoiceController",["$scope","$routeParams","currencyService","payAndInvoiceService","invoiceService","invoiceItemService","purchaseService","purchaseItemService","appAddressDataService","$location",function(n,t,i,r,u,f,e,o,s,h){var w,b,k,l,a;n.purchaseGridOptions={columns:[{field:"PurchaseDate",title:"Date",template:"#=(moment(PurchaseDate).isValid() ? moment(PurchaseDate).format('MM/DD/YYYY HH:mm') : '')#"},{field:"Reference",title:"Reference"},{field:"CarrierSCAC",title:"SCAC"},{field:"LocationName",title:"Name"},{field:"BillOfLading",title:"Bill of Lading"},{field:"PurchaseTotal",title:"Total",template:"#=kendo.toString(PurchaseTotal || 0, 'C')# #=Currency#"},{field:"",title:"Biller",template:"#=BillerFirstName + ' ' + BillerLastName#"}],selectable:!0,resizable:!0,scrollable:!1};w=[{field:"ItemDate",title:"Date",template:"#=(moment(ItemDate).isValid() ? moment(ItemDate).format('MM/DD/YYYY HH:mm') : '')#"},{field:"ItemName",title:"Item"},{field:"Quantity",title:"Quantity"},{field:"BillingUnit",title:"Unit"},{field:"Price",title:"Price",template:"#=kendo.toString(Price || 0, 'C')# #=Currency#"},{field:"Total",title:"Total",template:"#=kendo.toString(Total || 0, 'C')# #=Currency#"},{field:"Pay",title:"Pay",template:"#if(Pay==1){#Pay<\/span>#}else if(Pay==0){#Den<\/span>#}#"},{field:"CheckDate",title:"Check Date",template:"#=(moment(CheckDate).isValid() ? moment(CheckDate).format('MM/DD/YYYY HH:mm') : '')#"},{field:"CheckNumber",title:"Check Number"},{field:"DateSentToOracle",title:"Date Sent To Oracle",template:"#=(moment(DateSentToOracle).isValid() ? moment(DateSentToOracle).format('MM/DD/YYYY HH:mm') : '')#"}];n.purchaseItemGridOptions={columns:w,selectable:!0,resizable:!0,scrollable:!1};b=[{field:"Date",title:"Date",template:"#=(moment(Date).isValid() ? moment(Date).format('MM/DD/YYYY HH:mm') : '')#"},{field:"Number",title:"Number"},{field:"LocationName",title:"Name"},{field:"Total",title:"Total",template:"#=kendo.toString(Total || 0, 'C')# #=Currency#"},{field:"Received",title:"Received",template:"#=kendo.toString(Received || 0, 'C')# #=Currency#"},{field:"",title:"Biller",template:"#=BillerFirstName + ' ' + BillerLastName#"},{field:"EDIDateTime",title:"EDI Date/Time",template:"#=(moment(EDIDateTime).isValid() ? moment(EDIDateTime).format('MM/DD/YYYY HH:mm') : '')#"}];n.invoiceGridOptions={columns:b,selectable:!0,resizable:!0,scrollable:!1};k=[{field:"ItemName",title:"Item"},{field:"Quantity",title:"Quantity"},{field:"BillingUnit",title:"Unit"},{field:"Price",title:"Price",template:"#=kendo.toString(Price || 0, 'C')# #=Currency#"},{field:"ItemTotal",title:"Total",template:"#=kendo.toString(ItemTotal || 0, 'C')# #=Currency#"},{field:"ItemPrint",title:"Print",template:"#if(ItemPrint==1){#Yes<\/span>#}else if(ItemPrint==0){#No<\/span>#}#"},{field:"ItemDate",title:"Date",template:"#=(moment(ItemDate).isValid() ? moment(ItemDate).format('MM/DD/YYYY HH:mm') : '')#"},{field:"DateSentToOracle",title:"Date Sent To Oracle",template:"#=(moment(DateSentToOracle).isValid() ? moment(DateSentToOracle).format('MM/DD/YYYY HH:mm') : '')#"}];n.invoiceItemGridOptions={columns:k,selectable:!0,resizable:!0,scrollable:!1};var v=function(n){return new kendo.data.DataSource({data:n})},y=function(){n.selectedPurchaseData=null;n.selectedPurchaseItemData=null},p=function(){n.selectedInvoiceData=null;n.selectedInvoiceItemData=null;n.paymentHistorySummary=null;n.paymentHistoryDetails=null},c=function(){y();p()},d=function(){for(var i=0,r=0,t=0;ti.includes(n.CurShortName))},function(){n.setErrorMessage("An error occurred while retrieving the currencies.")});t.shipmentId&&(n.shipmentId=t.shipmentId,n.searchByShipmentId());n.viewShipmentDetails=function(){window.open(`/WebClient/EmptyNoMaps/#/admin-shipment/${n.shipmentId}`,"_blank","height=900,width=1100,resizable=1,status=0,location=0,toolbar=0,menubar=0");n.shipmentNumber=null};n.notesFailuresUtility=function(){h.path("/NotesFailuresUtility")}}]);xpoNlmModule.controller("ProjectTrackingController",["$scope","$routeParams","projectTrackingData","projectService","xpoNlmCustomKendoService","$rootScope","$document",function(n,t,i,r,u,f,e){"use strict";var s={errors:{search_field:"Only one project may be provided in the search field.",search_parameters:"There was an error processing your search. Please verify your search parameters are correct. If you are still experiencing issues, please contact your system administrator."}},o=i;n.CustomKendoService=u;n.ProjectService=r;n.ProjectTrackingData=i;n.displayResults=!1;n.displaySearching=!1;n.refreshScript=function(t){var i=window.open("/admin/admUPMAuctionDetails.asp?PrjId="+t,"ProjectDetails","width=650px,height=550px,scrollbars=yes,toolbar=0,menubar=1,resizable=1"),r=setInterval(function(){if(i.closed){clearInterval(r);try{n.loadTrackingSearchResults()}catch(t){}}},1e3)};n.columnSchemaAdmin=[{field:"Status",title:"Status",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("Status",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"ProjectId",filterable:!1,template:"#=ProjectId#<\/a>",title:"Project #"},{field:"AuctionClose",filterable:!1,template:'#if(AuctionClose != ""){##= moment(AuctionClose).format("YYYY-MM-DD HH:mm")#<\/span> #}#',title:"Auction Close"},{field:"Customer",filterable:!1,title:"Customer"},{field:"OriginName",title:"Origin Name",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("OriginName",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"DestinationName",title:"Destination Name",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("DestinationName",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"CarrierInfo",title:"Carrier",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("CarrierInfo",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"RouteNumber",filterable:!1,title:"Route Number"},{field:"StartDate",filterable:!1,template:'#if(StartDate != ""){##= moment(StartDate).format("YYYY-MM-DD HH:mm")#<\/span> #}#',title:"Project Start Date"},{field:"EndDate",filterable:!1,template:'#if(EndDate != ""){##= moment(EndDate).format("YYYY-MM-DD HH:mm")#<\/span> #}#',title:"Project End Date"}];n.columnSchemaCustomer=[{field:"Status",title:"Status",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("Status",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"ProjectId",filterable:!1,template:"#=ProjectId#<\/a>",title:"Project #"},{field:"AuctionClose",title:"Auction Close",template:'#if(AuctionClose != ""){##= moment(AuctionClose).format("YYYY-MM-DD HH:mm")#<\/span> #}#',filterable:!1},{field:"OriginName",title:"Origin Name",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("OriginName",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"DestinationName",title:"Destination Name",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("DestinationName",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"CarrierInfo",title:"Carrier",filterable:{ui:n.CustomKendoService.getDropDownMultiSelectFilter("CarrierInfo",n.ProjectService,"searchResults","trackingResultsGrid")}},{field:"RouteNumber",filterable:!1,title:"Route Number"},{field:"StartDate",filterable:!1,template:'#if(StartDate != ""){##= moment(StartDate).format("YYYY-MM-DD HH:mm")#<\/span> #}#',title:"Project Start Date"},{field:"EndDate",filterable:!1,template:'#if(EndDate != ""){##= moment(EndDate).format("YYYY-MM-DD HH:mm")#<\/span> #}#',title:"Project End Date"},{field:"PayerName",filterable:!1,title:"Responsible Plant"}];n.gridOptions={columns:o.isAdmin&&!o.isCustomer?n.columnSchemaAdmin:n.columnSchemaCustomer,groupable:!0,pageable:!0,reorderable:!0,selectable:!0,sortable:!0,toolbar:["excel"],excel:{allPages:!0,fileName:"Project Tracking.xlsx"},excelExport:function(n){for(var r,i,t,f=n.workbook.sheets[0],u=1;uu?1:0};return n.sort(i)},i={data:t(n.ProjectService.searchResults,"Status"),pageSize:20,schema:{model:{fields:n.ProjectService.searchResultsSchema}}};n.displayResults=!0;n.displaySearching=!1;n.gridDataSource=new kendo.data.DataSource(i);n.searchResultsCount=n.ProjectService.searchResults.length},y=function(t,i){var u,r;if(n.searchErrors=[],i===400)for(r=0;rn.Status!==0)},f=function(){n.displayError=!0};t.getCustomerList(u,f);n.gridOptions={columns:[{field:"CstName",title:"Customer",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("CstName",t,"searchResults","carrierResultsGrid")}},{field:"ShpId",title:"Shipment #",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("ShpId",t,"searchResults","carrierResultsGrid")}},{field:"AccFullName",title:"User Name",width:"150px",filterable:{ui:i.getDropDownMultiSelectFilter("AccFullName",t,"searchResults","carrierResultsGrid")}},{field:"AccExportDateTime",title:"Exported",width:"120px",template:'#if(AccExportDateTime == "0001-01-01T00:00:00"){ #N/A<\/span>#}else{##= moment(AccExportDateTime).format("YYYY-MM-DD HH:mm")#<\/span> #}#',filterable:{ui:i.getDropDownMultiSelectFilter("AccExportDateTime",t,"searchResults","carrierResultsGrid")}},{field:"BidResponse",title:"Response",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("BidResponse",t,"searchResults","carrierResultsGrid")}},{field:"BidReason",title:"Reason",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("BidReason",t,"searchResults","carrierResultsGrid")}},{field:"ShpReady",title:"Ready",width:"120px",template:'#if(ShpReady == "0001-01-01T00:00:00"){ #N/A<\/span>#} else {##= moment(ShpReady).format("YYYY-MM-DD HH:mm")#<\/span> #}#',filterable:{ui:i.getDropDownMultiSelectFilter("ShpReady",t,"searchResults","carrierResultsGrid")}},{field:"ShpProtectTime",title:"Protect",width:"120px",template:'#if(ShpProtectTime == "0001-01-01T00:00:00"){ #N/A<\/span>#} else {##= moment(ShpProtectTime).format("YYYY-MM-DD HH:mm")#<\/span> #}#',filterable:{ui:i.getDropDownMultiSelectFilter("ShpProtectTime",t,"searchResults","carrierResultsGrid")}},{field:"CupStpEtaOrigin",title:"Pick Up ETA",width:"120px",template:'#if(CupStpEtaOrigin == "0001-01-01T00:00:00"){ #N/A<\/span>#} else {##= moment(CupStpEtaOrigin).format("YYYY-MM-DD HH:mm")#<\/span> #}#',filterable:{ui:i.getDropDownMultiSelectFilter("CupStpEtaOrigin",t,"searchResults","carrierResultsGrid")}},{field:"CupStpEtaDestination",title:"Delivery ETA",width:"120px",template:'#if(CupStpEtaDestination == "0001-01-01T00:00:00"){ #N/A<\/span>#} else {##= moment(CupStpEtaDestination).format("YYYY-MM-DD HH:mm")#<\/span> #}#',filterable:{ui:i.getDropDownMultiSelectFilter("CupStpEtaDestination",t,"searchResults","carrierResultsGrid")}},{field:"OriginLocName",title:"Location Origin Name",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("OriginLocName",t,"searchResults","carrierResultsGrid")}},{field:"OriginLocCity",title:"Origin City",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("OriginLocCity",t,"searchResults","carrierResultsGrid")}},{field:"OriginLocState",title:"Origin State",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("OriginLocState",t,"searchResults","carrierResultsGrid")}},{field:"OriginLocCountry",title:"Origin Country",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("OriginLocCountry",t,"searchResults","carrierResultsGrid")}},{field:"DestLocName",title:"Destination Origin Name",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("DestLocName",t,"searchResults","carrierResultsGrid")}},{field:"DestLocCity",title:"Destination City",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("DestLocCity",t,"searchResults","carrierResultsGrid")}},{field:"DestLocState",title:"Destination State",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("DestLocState",t,"searchResults","carrierResultsGrid")}},{field:"DestLocCountry",title:"Destination Country",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("DestLocCountry",t,"searchResults","carrierResultsGrid")}},{field:"AccAcceptance",title:"Award",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("AccAcceptance",t,"searchResults","carrierResultsGrid")}},{field:"DimPieces",title:"Pieces",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("DimPieces",t,"searchResults","carrierResultsGrid")}},{field:"DimWeight",title:"Weight",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("DimWeight",t,"searchResults","carrierResultsGrid")}},{field:"OpzVtpId",title:"Vehicle Type Optimized",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("OpzVtpId",t,"searchResults","carrierResultsGrid")}},{field:"AccExportMode",title:"Mode",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("AccExportMode",t,"searchResults","carrierResultsGrid")}},{field:"TrpMileage",title:"Mileage",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("TrpMileage",t,"searchResults","carrierResultsGrid")}},{field:"AccNewBidCost",title:"Bid Amount",width:"120px",filterable:{ui:i.getDropDownMultiSelectFilter("AccNewBidCost",t,"searchResults","carrierResultsGrid")}}],groupable:!0,pageable:!0,reorderable:!0,selectable:!0,sortable:!0,scrollable:!0,resizeable:!0,toolbar:["excel"],excel:{allPages:!0,fileName:"CarrierReport.xlsx"},filterable:{extra:!1,operators:{string:{eq:"Is equal to",neq:"Is not equal to"}}}};n.loadCarrierReportSearchResults=function(){var f=function({data:i}){n.searchResults=i;t.searchResults=i;var r={data:i,pageSize:30};n.displayResults=!0;n.displaySearching=!1;n.gridDataSource=new kendo.data.DataSource(r);n.searchResultsCount=i.length},e=function({data:t,status:i}){n.searchErrors=[];i===500&&(t.ExceptionMessage.includes("SqlDateTime overflow.")?n.searchErrors.push("Please enter a valid date"):t.ExceptionMessage.includes("Execution Timeout Expired.")&&n.searchErrors.push("Execution Timeout. Please reduce the range between the Start Date and End Date or the server is not responding."));n.displaySearching=!1;n.displayResults=!1;n.displayError=!0},i,u;n.displayResults=!1;n.displayError=!1;i=function(n){for(var i=[],t=0;t<\/div>",width:"60px"}],sortable:!0,height:350};n.selectContact=function(t){var i=_.find(n.contacts,{CarrierContactId:t});i.Selected=!i.Selected};n.cancel=function(){window.close()};n.send=function(){var f,r,e;if(n.clearErrors(),f=_.filter(n.contacts,{Selected:!0}),r=_.map(f,"EmailAddress"),r.length==0){u("Please select one or more recipients.");return}e={ShipmentId:t.shipmentId,Recipients:r};n.submitInProgress=!0;i.sendLetterTariff(e,function(){n.submitInProgress=!1;window.close()},function(t){t.Message||t.ExceptionMessage?(t.Message&&u(t.Message),t.ExceptionMessage&&u(t.ExceptionMessage)):u("Sending Letter Tariff failed for an unknown reason.");n.submitInProgress=!1})};t.shipmentId&&!isNaN(t.shipmentId)&&t.shipmentId.trim().length>0?n.shipmentId=t.shipmentId:u("A valid shipment number was not provided.");t.carrierId&&!isNaN(t.carrierId)&&t.carrierId.trim().length>0?(n.searchInProgress=!0,r.getContacts(t.carrierId).then(function({data:t}){n.contacts=_.filter(t,function(n){if(n.EmailAddress)return n});n.contactsGridDataSource=new kendo.data.DataSource({data:n.contacts});n.searchInProgress=!1})):u("The Carrier was not provided.")}]);xpoNlmModule.controller("SendRateAgreementController",["$scope","$routeParams","contactData","rateAgreementService",function(n,t,i,r){n.errorMessages=[];var u=function(t,i){n.errorMessages.push(t+(i?" ("+i+") ":""))};n.clearErrors=function(){n.errorMessages=[]};n.contactsGridOptions={columns:[{field:"FirstName",title:"First Name"},{field:"LastName",title:"Last Name"},{field:"EmailAddress",title:"E-Mail"},{title:"Select",template:"

<\/div>",width:"60px"}],sortable:!0,height:350};n.selectContact=function(t){var i=_.find(n.contacts,{Id:t});i.Selected=!i.Selected};n.cancel=function(){window.close()};n.send=function(){var f,i,e;if(n.clearErrors(),f=_.filter(n.contacts,{Selected:!0}),i=_.map(f,"EmailAddress"),i.length==0){u("Please select one or more recipients.");return}e={ShipmentId:t.shipmentId,Recipients:i,RateQuotationNote:n.rateQuotationNote};n.submitInProgress=!0;r.sendRateAgreement(e,function(){n.submitInProgress=!1;window.close()},function(t){t.Message||t.ExceptionMessage?(t.Message&&u(t.Message),t.ExceptionMessage&&u(t.ExceptionMessage)):u("Sending Rate Agreement failed for an unknown reason.");n.submitInProgress=!1})};t.shipmentId&&!isNaN(t.shipmentId)&&t.shipmentId.trim().length>0?n.shipmentId=t.shipmentId:u("A valid shipment number was not provided.");t.payorLocationId&&!isNaN(t.payorLocationId)&&t.payorLocationId.trim().length>0?(n.searchInProgress=!0,i.getContacts(t.payorLocationId,function(t){n.contacts=_.filter(t,function(n){if(n.EmailAddress)return n});n.contactsGridDataSource=new kendo.data.DataSource({data:n.contacts});n.searchInProgress=!1})):u("The Payor Location was not provided.")}]);xpoNlmModule.controller("AdminShipmentDetailsController",["$window","$scope","$routeParams","$uibModal","$http","$location","Enum","xpoNlmRedirectService","shipmentService","shipmentDetailsData","premiumCodeService","$rootScope",function(n,t,i,r,u,f,e,o,s,h,c,l){t.mapPtr=null;t.mappingController=null;t.controllerPtr=null;n.resizeTo(1e3,900);$(n.document).find("html").addClass("shipment-details");t.$on("$destroy",function(){$(n.document).find("html").removeClass("shipment-details")});t.shipment_id=i.shipmentId;document.title="Shipment #"+t.shipment_id;t.ColumnCount=0;t.Enum=e;t.redirectService=o;t.shipmentDetailsData=h;t.displayedNotes=[];t.noop=!0;t.isAdmin=l.isAdmin;t.displayError=!1;t.viewImageUri="/details.asp?ViewImages=1&&ShpId="+t.shipment_id;t.editMode=!1;t.currencySymbol="$";var a="(866) 656-4266",v="(866) 656-4266 Prompt #1, then 8",y="(800) 781-0027",p="(866) 251-3651",w=l.ServerName+l.WebClientPath+"/Content/print.css";_.assign(t,{printStyles:w});t.paymentTermsList=[{Id:3,Name:"Collect"},{Id:2,Name:"Prepaid"},{Id:4,Name:"Third Party"}];t.premiumCodesList=[];t.statusCodesList=[{Id:"0",Name:"Pending Shipment"},{Id:"1",Name:"Carrier Unassigned"},{Id:"2",Name:"Carrier Assigned/En Route to Pickup"},{Id:"4",Name:"At Shipper"},{Id:"5",Name:"En Route to Destination"},{Id:"6",Name:"At Destination"},{Id:"7",Name:"Shipment Delivered"}];var b=[{key:"Hazmat",icon:"xico-indicator-hazmat",show:{icon:!1,text:!0},title:"Hazmat"},{key:"Critical",icon:"xico-nlm_critical",show:{icon:!1,text:!0},title:"Critical"},{key:"CSA",icon:"xico-nlm_csa",show:{icon:!1,text:!0},title:"CSA"},{key:"FAST",icon:"xico-nlm_fast",show:{icon:!1,text:!0},title:"FAST"},{key:"WeatherProtection",icon:"xico-indicator-umbrella",show:{icon:!1,text:!0},title:"Weather Protection"},{key:"RoundTrip",icon:"xico-lane-switch-hor",show:{icon:!1,text:!0},title:"Round Trip"},{key:"Multileg",icon:"xico-nlm_multi_leg",show:{icon:!1,text:!0},title:"Multileg"}],k=function(n){var i=n.ShipmentDetails&&n.ShipmentDetails.CustomerId?n.ShipmentDetails.CustomerId.Value:0,r=n.ShipmentDetails&&n.ShipmentDetails.OneCallCustomer?n.ShipmentDetails.OneCallCustomer.Value:!1;t.displayError=!1;h.shipment=n;switch(!0){case i===106:t.shipmentChangesPhoneNumber=y;break;case i===1:t.shipmentChangesPhoneNumber=p;break;case r:t.shipmentChangesPhoneNumber=v;break;default:t.shipmentChangesPhoneNumber=a}t.origin=n.Stops.length>0?n.Stops[0].StopLocation.City.Value+", "+n.Stops[0].StopLocation.State.Value:"No Stops for Location";t.destination=n.Stops.length>0?n.Stops[n.Stops.length-1].StopLocation.City.Value+", "+n.Stops[n.Stops.length-1].StopLocation.State.Value:"No Destination for Location. No Stops";t.modeGroup=n.ShipmentDetails.ModeGroup!=null?n.ShipmentDetails.ModeGroup.Value:"No Mode Group";t.modeType=n.ShipmentDetails.ModeType!=null?n.ShipmentDetails.ModeType.Value:"No Mode Type";t.displayedNotes=n.Notes;t.isParcel=t.modeGroup==="Parcel"?!0:!1;t.AwardedCost=n.ShipmentDetails.AwardedCost.Value;t.ShipmentAllocations=n.ShipmentAllocations;t.shipmentStatus=h.shipment.ShipmentDetails.Status.Value;t.shipmentStatusName=t.statusCodesList[Object.keys(t.statusCodesList).find(n=>t.statusCodesList[n].Id==t.shipmentStatus)].Name;t.shipmentPaymentTerm=t.paymentTermsList[Object.keys(t.paymentTermsList).find(n=>t.paymentTermsList[n].Name===h.shipment.ShipmentDetails.ShipmentTerms.Value)].Id;t.voidStatus=h.shipment.ShipmentDetails.Void.Value!==2?"":"Called Off";t.shipmentIsCompleted=h.shipment.ShipmentDetails.Status.Value===7;t.statusFlags=_.filter(b,function(n){return!!h.shipment.ShipmentDetails[n.key].Value});h.pristineShipment&&h.pristineShipment.PackagingItemNumbers&&(t.packagingItemNumbers=h.pristineShipment.PackagingItemNumbers.join(", "));t.CarrierDimensionsPristine=_.cloneDeep(h.shipment.CarrierDimensions);t.isMexico=_.some(n.Stops,function(n){return n.StopLocation.IsMexico.Value});t.printNotes=t.filterNotesByType(["Export Note","Awarded Carrier"]);var u=function(){var n=function(n,t){h.equipment[t].UnitNumber.Value=_.trim(n.UnitNumber.Value)},t=function(n){return _.trim(h.shipment.EquipmentUpdateId.EquipmentId.Value)===_.trim(n.EquipmentId.Value)};_.each(h.equipment,n);h.shipment.EquipmentUpdateId=_.find(h.equipment,t)},f=function(n){angular.isArray(n)&&(h.equipment=n);u()},e=function(n){angular.isArray(n)&&(t.premiumCodesList=n);var i=function(n,i){t.premiumCodesList[i].Code=_.trim(n.Code);t.premiumCodesList[i].Name=_.trim(n.Name)},r=function(n){return h.shipment.ShipmentDetails.PremiumCodeId.Value===n.Id};_.each(t.premiumCodesList,i);t.shipmentPremiumCode=_.find(t.premiumCodesList,r);t.shipmentPremiumCode=t.shipmentPremiumCode.Id};s.getEquipment(h.shipment.ShipmentDetails.CarrierId.Value,f,angular.noop);c.getPremiumCodesWithCustomerId(i,e,angular.noop)},d=function(){t.displayError=!0};s.getShipment(t.shipment_id,k,d);s.getNewDimension(function(n){h.newDimension=n},function(){});s.getAllPackagingTypes(function(n){h.allPackagingTypes=n;var t=function(){h.newDimension.Packaging=_.find(h.allPackagingTypes,function(n){return n.Name.Value==="Unspecified"})};t()},function(){});s.getDrivers(function(n){h.drivers=n},function(){});s.getDrayageList(function(n){h.drayageList=n},function(){});s.getStates(function(n){h.states=n},function(){});t.setMode=function(n){t.PageMode=n==null?t.PageMode==e.ControlMode.ReadOnly?e.ControlMode.Edit:e.ControlMode.ReadOnly:n;t.controls.carrierUpdatedDimensions.controlMode=t.controls.calledInDimensions.controlMode=t.PageMode;t.controls.calledInDimensions.controlMode=e.ControlMode.ReadOnly};t.controls={};t.controls.carrierUpdatedDimensions={};t.controls.calledInDimensions={};t.setMode(e.ControlMode.Edit);t.control=t;t.controllerPtr=t.control;t.mapControllerPtr=t.gridControllerPtr=null;t.Enum=e;t.registerMapScope=function(n){t.mapControllerPtr=n};t.registerGridScope=function(n){t.gridControllerPtr=n};t.loadMap=function(){t.mapControllerPtr&&angular.isFunction(t.mapControllerPtr.initMap)?t.mapControllerPtr.initMap():console.warn("Couldn't initialize map")};t.typeOptions=[{name:"All",id:"All"},{name:"Trip Note",id:"Trip"},{name:"Carrier Note",id:"Carrier"}];t.selectedOption=t.typeOptions[0];t.filterNotesByType=function(n){for(var i=[],t=0;t0&&(f.shipment.AllErrors=[]);e.updateShipment(f.shipment,n,t)};u.openUpdateErrorMessageModal=function(t){n.open({controller:"UpdateErrorMessageModalController",resolve:{},size:t,templateUrl:s+"UpdateErrorMessageModal.html",windowClass:"mt-expedite-legacy"})};u.openUpdateSuccessMessageModal=function(t){n.open({controller:"UpdateSuccessMessageModalController",resolve:{},size:t,templateUrl:s+"UpdateSuccessMessageModal.html",windowClass:"mt-expedite-legacy"})};u.isTruckload=function(){return u.shipmentDetailsData.shipment.Details.ModeGroup=="Truckload"?!0:!1};u.DropTrailerQuestion=function(){u.isDropTrailer&&u.isTruckload()&&(u.ReloadedToOrigin=null,u.ReloadedToOtherLocation=null)};u.ReloadedToOriginQuestion=function(){u.ReloadedToOrigin&&(u.ReloadedToOtherLocation=null,u.isTruckload()||(u.isDropTrailer=null))};u.ReloadedToOtherLocationQuestion=function(){u.ReloadedToOtherLocation&&(u.isTruckload()||(u.isDropTrailer=null))};u.isValid=function(){return u.isDropTrailer?!0:u.ReloadedToOrigin&&(u.returnTimeValue||f.shipment.ETARoundTripTimeToOrigin)?!0:u.ReloadedToOtherLocation&&f.shipment.differentOriginETA&&u.input.selectedcarriermanager.locationId?!0:u.isTruckload()&&u.ReloadedToOtherLocation!=null&&u.ReloadedToOtherLocation==!1?!0:!u.isTruckload()&&u.isDropTrailer!=null&&u.isDropTrailer==!1?!0:!1};u.Ok=function(){u.updateShipmentFromModal();t.close()};u.Cancel=function(){t.dismiss("cancel")}}]);xpoNlmModule.controller("shipmentDetailsController",["$window","$scope","$route","$routeParams","$uibModal","Enum","xpoNlmRedirectService","shipmentService","shipmentDetailsData","$rootScope",function(n,t,i,r,u,f,e,o,s,h){t.mapPtr=null;t.mappingController=null;t.controllerPtr=null;$(n.document).find("html").addClass("shipment-details");t.$on("$destroy",function(){$(n.document).find("html").removeClass("shipment-details")});t.shipment_id=r.shipmentId;document.title="Shipment #"+t.shipment_id;t.ColumnCount=0;t.Enum=f;t.redirectService=e;t.shipmentDetailsData=s;t.displayedNotes=[];t.isCustomer=h.isImpersonatingCustomer||h.isCustomer;t.isCarrier=h.isImpersonatingCarrier||h.isCarrier;t.noop=!0;t.isAdmin=h.isAdmin;t.displayError=!1;t.viewImageUri=t.isCustomer?"/customer/shd.asp?shdP=Files&ShpId="+t.shipment_id:t.isCarrier?"/carrier/details.asp?ShpId="+t.shipment_id+"&ViewImages=1":"/details.asp?ViewImages=1&&ShpId="+t.shipment_id;t.webTasks=[];var c="(866) 656-4266",l="(866) 656-4266 Prompt #1, then 8",a="(800) 781-0027",v="(866) 251-3651",y=h.ServerName+h.WebClientPath+"/Content/print.css";_.assign(t,{printStyles:y});var p={0:"Pending Shipment",1:"Carrier Unassigned",2:"Carrier Assigned/En Route to Pickup",4:"At Shipper",5:"En Route to Destination",6:"At Destination",7:"Shipment Delivered"},w=[{key:"Hazmat",icon:"xico-indicator-hazmat",show:{icon:!1,text:!0},title:"Hazmat"},{key:"Critical",icon:"xico-nlm_critical",show:{icon:!1,text:!0},title:"Critical"},{key:"CSA",icon:"xico-nlm_csa",show:{icon:!1,text:!0},title:"CSA"},{key:"FAST",icon:"xico-nlm_fast",show:{icon:!1,text:!0},title:"FAST"},{key:"WeatherProtection",icon:"xico-indicator-umbrella",show:{icon:!1,text:!0},title:"Weather Protection"},{key:"RoundTrip",icon:"xico-lane-switch-hor",show:{icon:!1,text:!0},title:"Round Trip"},{key:"Multileg",icon:"xico-nlm_multi_leg",show:{icon:!1,text:!0},title:"Multileg"}],b=function(n){var i=n.Details&&n.Details.CustomerId?n.Details.CustomerId:0,f=n.Details&&n.Details.OneCallCustomer?n.Details.OneCallCustomer:!1,r,u;t.loading=!1;t.displayError=!1;s.shipment=n;o.getOriginETAChangeReasons(n.Details.ModeGroupId,n.Details.ModeTypeId,n=>{s.originETAChangeReasons=n},function(){});o.getDestinationETAChangeReasons(n.Details.ModeGroupId,n.Details.ModeTypeId,n=>{s.destinationETAChangeReasons=n},function(){});o.getShipmentStopSchedule(n.Stops[n.Stops.length-1]?.LocationId,n=>{s.Schedule=n},function(){});switch(!0){case i===106:t.shipmentChangesPhoneNumber=a;break;case i===1:t.shipmentChangesPhoneNumber=v;break;case f:t.shipmentChangesPhoneNumber=l;break;default:t.shipmentChangesPhoneNumber=c}s.pristineShipment=angular.copy(n);t.origin=n.Stops.length>0?n.Stops[0].LocationCity+", "+n.Stops[0].LocationState:"No Stops for Location";t.destination=n.Stops.length>0?n.Stops[n.Stops.length-1].LocationCity+", "+n.Stops[n.Stops.length-1].LocationState:"No Destination for Location. No Stops";t.modeGroup=n.Details.ModeGroup!=null?n.Details.ModeGroup:"No Mode Group";t.modeType=n.Details.ModeType!=null?n.Details.ModeType:"No Mode Type";t.isParcel=n.Details.ParcelTrackingNumber!=null?!0:!1;t.displayedNotes=n.Notes;t.AwardedCost=n.Details.AwardedCost;t.Allocations=n.Allocations;t.shipmentStatus=p[s.shipment.Details.Status];t.voidStatus=s.shipment.Details.Void!==2?"":"Called Off";t.shipmentIsCompleted=s.shipment.Details.Status===7;t.statusFlags=_.filter(w,function(n){return!!s.shipment.Details[n.key]});s.pristineShipment&&s.pristineShipment.PackagingItemNumbers&&(t.packagingItemNumbers=s.pristineShipment.PackagingItemNumbers.join(", "));t.CarrierDimensionsPristine=_.cloneDeep(s.shipment.CarrierDimensions);t.isInterMexico=_.some(n.Stops,function(n){return n.LocationCountryId==139})&&_.some(n.Stops,function(n){return n.LocationCountryId!=139});t.printNotes=t.filterNotesByType(["Export Note","Awarded Carrier"]);r=function(n){s.equipment=n};o.getEquipment(s.shipment.Details.CarrierId,r,angular.noop);u=function(n){s.drayageList=n};o.getDrayageList(u,angular.noop);for(let n in s.shipment.Stops)s.shipment.Stops[n].ShowETAChangeReason=!1},k=function(){t.loading=!1;t.displayError=!0};t.loading=!0;o.getShipment(t.shipment_id,b,k);t.isCustomer&&o.getWebTasks(t.shipment_id,function(n){t.webTasks=n},function(){});s.newDimension={DimensionId:undefined,Length:undefined,Width:undefined,Height:undefined,Weight:undefined,Stackable:undefined,Quantity:undefined,Type:undefined,RowVersion:undefined,RowIndex:undefined,PackagingType:undefined,PackagingName:undefined,Description:undefined,Bulk:undefined,Strap:undefined,PerPieceQuantity:undefined,NonRackQuantity:undefined,TotalRacks:undefined,EnteredAsMetric:undefined,IsFlaggedForDeletion:undefined};o.getAllPackagingTypes(function(n){s.allPackagingTypes=n;var t=_.find(s.allPackagingTypes,function(n){return n.Name==="Unspecified"});s.newDimension.PackagingType=t.PackagingTypeId;s.newDimension.PackagingName=t.Name},function(){});o.getDrivers(function(n){s.drivers=n},function(){});o.getDrayageList(function(n){s.drayageList=n},function(){});o.getStates(function(n){s.states=n},function(){});t.setMode=function(n){t.PageMode=n==null?t.PageMode==f.ControlMode.ReadOnly?f.ControlMode.Edit:f.ControlMode.ReadOnly:n;t.controls.carrierUpdatedDimensions.controlMode=t.controls.calledInDimensions.controlMode=t.PageMode};t.controls={};t.controls.carrierUpdatedDimensions={};t.controls.calledInDimensions={};t.setMode(f.ControlMode.ReadOnly);t.control=t;t.controllerPtr=t.control;t.mapControllerPtr=t.gridControllerPtr=null;t.Enum=f;t.registerMapScope=function(n){t.mapControllerPtr=n};t.registerGridScope=function(n){t.gridControllerPtr=n};t.loadMap=function(){t.mapControllerPtr&&angular.isFunction(t.mapControllerPtr.initMap)?t.mapControllerPtr.initMap():console.warn("Couldn't initialize map")};t.typeOptions=[{name:"All",id:"All"},{name:"Trip Note",id:"Trip"},{name:"Carrier Note",id:"Carrier"}];t.selectedOption=t.typeOptions[0];t.filterNotesByType=function(n){for(var i=[],t=0;tn!==21)})};t.onCheckCallClick=function(n){var t=u.open({animation:!0,templateUrl:h.WebClientPath+"/Modules/XpoNlm/Widgets/CarrierRequiredUpdates/DirectiveTemplates/CarrierCheckCallModalTemplate.html",controller:"CarrierCheckCallModalController",resolve:{shipmentId:function(){return n}}});t.result.then(function(n){n&&i.reload()},angular.noop)};t.approveCostModal=function(){t.openAwardCostApprovalModal()};t.resolveWebTask=function(n,t){o.resolveWebTask(n,t,function(){location.reload()},function(){})};t.openAwardCostApprovalModal=function(){u.open({templateUrl:h.WebClientPath+"/Modules/XpoNlm/Common/Views/ApproveCostModal.html",controller:"ApproveCostInstanceController",windowClass:"small-Message-Modal mt-expedite-legacy",backdrop:"static",keyboard:!1})}}]);xpoNlmModule.controller("UpdateErrorMessageModalController",["$uibModal","$uibModalInstance","$scope","shipmentDetailsData",function(n,t,i,r){"use strict";i.shipmentDetailsData=r;i.errors=_.uniq(_.compact(r.shipment.AllErrors));i.Ok=function(){t.close()};i.Cancel=function(){t.dismiss("cancel")}}]);xpoNlmModule.controller("UpdateShipmentModalController",["$uibModal","$uibModalInstance","$scope","error",function(n,t,i,r){"use strict";i.errors=_.uniq(_.compact(r));i.Ok=function(){t.close()};i.Cancel=function(){t.dismiss("cancel")}}]);xpoNlmModule.controller("UpdateSuccessMessageModalController",["$uibModal","$uibModalInstance","$rootScope","$scope","shipmentDetailsData",function(n,t,i,r,u){"use strict";r.shipmentDetailsData=u;r.hasPendingBackHaulDryRun=!!i.hasPendingDryRunBackhaul;r.Ok=function(){t.close()};r.Cancel=function(){t.dismiss("cancel")}}]);xpoNlmModule.controller("VehicleTypeWarningModalController",["$uibModalInstance","$scope","shipmentDetailsData",function(n,t,i){"use strict";var r=function(){n.close()},u=function(){n.dismiss("cancel")},f=i.shipment.Details;_.assign(t,{cancel:u,details:f,ok:r})}]);xpoNlmModule.controller("ContractNumberController",["$scope","specializedService","$uibModalInstance","contractNumber",function(n,t,i,r){var o=function(t){return _.filter(t,function(t){return _.includes(_.toLower(t.ContractNumber),_.toLower(n.contractNumberFilter))})},f,u,e;_.isNil(r)||(n.isRowSelected=!0);n.applyContractNumberFilter=function(){u.read()};f=function(){n.isRowSelected=!0;var t=this.select(),i=this.dataItem(t);n.selectedContractNumber=i};n.closeModal=function(){i.close(n.selectedContractNumber)};u=new kendo.data.DataSource({transport:{read:function(i){t.getSpecializedContractNumbers().then(function({data:t}){n.viewClosedContractNumbers!==!0&&(t=_.filter(t,{IsClosed:!1}));n.contractNumberFilter!=null&&(t=o(t));i.success(t);n.errorMessages=null},function({data:t}){n.errorMessages=t.ExceptionMessage;i.error(t.ExceptionMessage)})},update:function(i){t.updateOrCreateThen({action:"Edit",type:"Contract"},i,n)},create:function(i){t.updateOrCreateThen({action:"Add",type:"Contract"},i,n)}},pageSize:15,autosync:!1,schema:{model:{id:"ContractId",fields:{ContractNumber:{editable:!0,nullable:!1},ContractAmount:{editable:!0,nullable:!1,type:"double"},IsClosed:{editable:!0,type:"boolean"}}}}});e={dataSource:u,toolbar:["create"],columns:[{field:"ContractNumber",title:"Contract Number"},{field:"ContractAmount",title:"Contract Amount"},{field:"IsClosed",title:"Closed",width:"60px",template:""},{title:"Actions",width:"180px",command:[{name:"edit"}]}],sortable:!0,pageable:{buttonCount:1},selectable:!0,change:f,editable:"inline"};n.$watch("viewClosedContractNumbers",function(n){_.isNil(n)||u.read()});_.assign(n,{contractNumberGridOptions:e})}]);xpoNlmModule.controller("CustomerReleasesController",["$scope","$rootScope","specializedService",function(n,t,i){var r;n.gridOptions={columns:[{field:"ReleaseNumber",title:"Release Number"},{field:"ReleaseAmount",title:"Release Amount",format:"{0:c}"},{field:"ReleaseSpent",title:"Release Spent",format:"{0:c}"},{field:"ReleaseBalance",title:"Release Balance",format:"{0:c}"},{field:"StartDate",title:"Start Date",template:"#= moment(StartDate).format('YYYY-MM-DD HH:mm')#<\/span>"},{field:"EndDate",title:"End Date",template:"#= moment(EndDate).format('YYYY-MM-DD HH:mm')#<\/span>"},{field:"Status",title:"Status"}],sortable:!0,pageable:{buttonCount:1}};n.datePickerOptions={format:"MM/dd/yyyy",parseFormats:["MM/dd","MM/dd/yy","MMMM dd, yyyy","MMMM dd"]};r=function(t){n.gridDataSource=new kendo.data.DataSource({data:t,pageSize:15})};n.searchInProgress=!1;n.includeClosed=!1;n.includePending=!0;n.search=function(){n.searchInProgress=!0;var u={releaseNumber:n.releaseNumber,startDate:n.startDate,endDate:n.endDate,customerId:t.customerId,includeClosed:n.includeClosed,includePending:n.includePending};i.getCustomerReleasePOs(u).then(function({data:t}){n.searchInProgress=!1;r(t)},function({data:t}){n.searchInProgress=!1;console.error(t)})};n.search()}]);xpoNlmModule.controller("ProjectsAndTasksController",["$scope","specializedService",function(n,t){var o=function(t){return _.filter(t,function(t){return _.includes(_.toLower(t.ProjectName),_.toLower(n.projectFilter))})},u=function(t){return _.filter(t,function(t){return _.includes(_.toLower(t.TaskName),_.toLower(n.taskFilter))})},s=function(){var i=this.select(),r=this.dataItem(i),t;n.selectedProject=r;t=n.$$phase;t!=="$apply"&&t!=="$digest"&&n.$apply()},h=function(){var i=this.select(),r=this.dataItem(i),t;n.selectedTask=r;t=n.$$phase;t!=="$apply"&&t!=="$digest"&&n.$apply()},r=new kendo.data.DataSource({transport:{read:function(i){t.getSpecializedProjects().then(function({data:t}){var r=t;n.selectedTask?(r=_.filter(t,{ProjectId:n.selectedTask.ProjectId}),i.success(r),n.errorMessages=null):(n.viewClosedProjects!==!0&&(r=_.filter(t,{IsClosed:!1})),n.projectFilter!=null&&(r=o(r)),i.success(r),n.errorMessages=null)},function({data:t}){n.errorMessages=t.ExceptionMessage;i.error(t.ExceptionMessage)})},update:function(i){t.updateOrCreateThen({action:"Edit",type:"Project"},i,n)},create:function(i){t.updateOrCreateThen({action:"Add",type:"Project"},i,n)}},pageSize:15,autosync:!1,schema:{model:{id:"ProjectId",fields:{ProjectName:{editable:!0,nullable:!1},IsClosed:{editable:!0,type:"boolean"}}}}}),i=new kendo.data.DataSource({transport:{read:function(i){var r=[];n.selectedProject?t.getSpecializedTaskByProjectId(n.selectedProject).then(function({data:t}){r=t;n.viewClosedTasks!==!0&&(r=_.filter(t,{IsClosed:!1}));n.taskFilter!=null&&(r=u(r));i.success(r);n.errorMessages=null},function({data:t}){n.errorMessages=t.ExceptionMessage;i.error(t.ExceptionMessage)}):t.getSpecializedTasks(n.searchParams).then(function({data:t}){r=t;n.viewClosedTasks!==!0&&(r=_.filter(t,{IsClosed:!1}));n.taskFilter!=null&&(r=u(r));i.success(r);n.errorMessages=null},function({data:t}){n.errorMessages=t.ExceptionMessage;i.error(t.ExceptionMessage)})},update:function(i){t.updateOrCreate({action:"Edit",type:"Task"},i.data).then(function({data:t}){i.success(t);n.errorMessages=null},function({data:t}){n.errorMessages=t.ExceptionMessage;i.error(t.ExceptionMessage)})}},pageSize:15,autosync:!1,schema:{model:{id:"TaskId",fields:{TaskName:{editable:!0,nullable:!1},IsClosed:{editable:!0,type:"boolean"}}}}}),c={dataSource:r,toolbar:["create"],columns:[{field:"ProjectName",title:"Programs"},{field:"IsClosed",title:"Closed",width:"60px",template:""},{title:"Actions",width:"180px",command:[{name:"edit"}]}],sortable:!0,pageable:{buttonCount:1},selectable:!0,change:s,editable:"inline"},l={autoBind:!1,dataSource:i,columns:[{field:"TaskName",title:"Tasks"},{field:"IsClosed",title:"Closed",width:"60px",template:""},{title:"Actions",width:"180px",command:["edit"]}],sortable:!0,pageable:{buttonCount:1},change:h,selectable:!0,editable:"inline"},f,e;n.datepickerOptions={format:"MM/dd/yyyy",parseFormats:["MM/dd","MM/dd/yy","MMMM dd, yyyy","MMMM dd"]};f=_.debounce(function(){r.read()},250);e=_.debounce(function(){i.read()},250);n.Search=function(){n.searchParams={startDate:n.dateStart,endDate:n.dateEnd,includeClosed:n.closedTasksSearch,taskName:n.taskNameSearch};n.selectedProject=null;n.kendo.projectsGrid.clearSelection();i.read()};n.addNewTask=function(){var r={TaskName:n.newTaskName,ProjectId:n.selectedProject.ProjectId};t.updateOrCreate({action:"Add",type:"Task"},r).then(function(){n.newTaskName=null;i.read()},function({data:t}){n.errorMessages=t.ExceptionMessage})};n.applyProjectFilter=function(){f()};n.applyTaskFilter=function(){e()};n.reset=function(){n.selectedProject=null;n.selectedTask=null;n.viewClosedProjects=null;n.viewClosedTasks=null;n.dateStart=null;n.dateEnd=null;n.taskNameSearch=null;n.projectFilter=null;n.taskFilter=null;n.closedTasksSearch=null;r.page(1);i.data([]);r.read()};n.$watch("selectedProject",function(n){_.isNil(n)||i.read()});n.$watch("selectedTask",function(n){_.isNil(n)||r.read()});n.$watch("viewClosedProjects",function(n){_.isNil(n)||r.read()});n.$watch("viewClosedTasks",function(t){_.isNil(t)||(n.searchParams={startDate:n.dateStart,endDate:n.dateEnd,includeClosed:n.viewClosedTasks,taskName:n.taskNameSearch},i.read())});_.assign(n,{projectGridOptions:c,taskGridOptions:l})}]);xpoNlmModule.controller("ReleasePoDetailsModalInstanceController",["$scope","$uibModalInstance","$rootScope","releasePO","$uibModal","specializedService","IsPOManager",function(n,t,i,r,u,f,e){function c(){return n.IsPOManager==!0?"<\/span>":"<\/span>"}var s,o,h;n.IsPOManager=e;n.model=r;s=[{field:"ShipmentId",title:"Shipment Number",template:"#=ShipmentId#<\/a>"},{field:"AssociatedCost",title:"Associated Cost"},{field:"Status",title:"Status"},{title:"Balance",width:"60px",command:[{template:c}]}];n.totalCost=function(){return _.sumBy(n.details,"AssociatedCost")};o=new kendo.data.DataSource({transport:{read:function(t){f.getReleasePODetails(r.ReleasePoId).then(function({data:i}){n.details=i;t.success(i)})}},pageSize:15,autosync:!1});h={noRecords:!0,dataSource:o,columns:s,sortable:!0,pageable:{buttonCount:1}};n.balance=function(n){f.POCostUpdate(n.ShipmentId).then(function(){o.read()})};n.BalancePO=function(){var i=n.totalCost(),r=n.model.ReleasePoId;f.BalancePOs(r,i).then(function(){t.close()})};_.assign(n,{gridOptions:h})}]);xpoNlmModule.controller("ReleasePoModalInstanceController",["$scope","$uibModalInstance","$rootScope","releasePO","selectedCustomer","$uibModal","countryData","unitOfMeasureData","departmentData","specializedService",function(n,t,i,r,u,f,e,o,s,h){n.model=_.cloneDeep(r);n.countryData=e;n.unitOfMeasureData=o;n.departmentData=s;n.selectedCustomer=u;n.datepickerOptions={format:"MM/dd/yyyy",parseFormats:["MM/dd","MM/dd/yy","MMMM dd, yyyy","MMMM dd","YYYY-MM-DD HH:mm","yyyy-MM-ddTHH:mm:ss",]};n.save=function(){n.model.AuthorizingPlantLocation=n.AuthorizingPlantLocation;n.model.CustomerId=n.selectedCustomer.Id;h.validate(n.model).then(function(){n.errors=null;t.close(n.model)},function({data:t}){n.errors=t.Message})};n.openContractNumber=function(){var t=f.open({templateUrl:i.WebClientPath+"/Modules/XpoNlm/Specialized/Views/ContractNumber.html",controller:"ContractNumberController",size:"lg",resolve:{contractNumber:function(){return n.model.ContractNumber}},windowClass:"mt-expedite-legacy"});t.result.then(function(t){t!==undefined&&(n.model.ContractId=t.ContractId,n.model.ContractNumber=t.ContractNumber)},angular.noop)};var c=function(n,t){return _.isNil(n)||_.isNil(t)?!0:(typeof n=="object"&&(n=n.toString()),typeof t=="object"&&(t=t.toString()),n=Date.parse(n),t=Date.parse(t),n>t)?!0:!1};n.isInvalid=function(){return c(n.model.StartDate,n.model.EndDate)||_.isNil(n.model.AuthorizingPlantLocationId)?!0:!1}}]);xpoNlmModule.controller("ReleasesController",["$scope","$rootScope","specializedService","$uibModal","featureService","customersService",function(n,t,i,r,u,f){function c(){return n.isPOManager==!0?"<\/span>":"<\/span>"}var s,h,o;n.isPOManager=!1;n.alertText=null;n.selectedCustomer={};n.customerList=[];u.isStaffFeatureEnabled(856,function(t){n.isPOManager=t;n.gridOptions={columns:s,sortable:!0,pageable:{buttonCount:1}}},function(){n.isPOManager=!1});f.getCustomerListWithFeature(854,function(){n.customerList=f.customers;n.customerList.unshift({Id:4,Name:"Stellantis"})},function(){n.customerList=[{Id:0,Name:"Could not retrieve customer list"}]});s=[{field:"ContractNumber",title:"Contract Number"},{field:"ReleaseNumber",title:"Release Number"},{field:"ReleaseAmount",title:"Release Amount",format:"{0:c}"},{field:"ReleaseSpent",title:"Release Spent",format:"{0:c}"},{field:"ReleaseBalance",title:"Release Balance",format:"{0:c}"},{field:"PlantCode",title:"Plant Code"},{field:"Department",title:"Department"},{field:"CreatedDate",title:"Created Date",template:"#= moment(CreatedDate).format('YYYY-MM-DD HH:mm')#<\/span>"},{field:"StartDate",title:"Start Date",template:"#= moment(StartDate).format('YYYY-MM-DD HH:mm')#<\/span>"},{field:"EndDate",title:"End Date",template:"#= moment(EndDate).format('YYYY-MM-DD HH:mm')#<\/span>"},{field:"ReferenceNumber",title:"MPN"},{field:"Status",title:"Status"},{title:"Edit",width:"60px",command:[{template:c}]},{title:"Details",width:"60px",command:[{template:"<\/span>"}]}];n.datePickerOptions={format:"MM/dd/yyyy",parseFormats:["MM/dd","MM/dd/yy","MMMM dd, yyyy","MMMM dd"]};h=function(t){n.gridDataSource=new kendo.data.DataSource({data:t,pageSize:15})};o=function(u){var f=r.open({templateUrl:t.WebClientPath+"/Modules/XpoNlm/Specialized/Views/ReleasePoModal.html",controller:"ReleasePoModalInstanceController",resolve:{releasePO:function(){return u.data},selectedCustomer:function(){return n.selectedCustomer}},size:"lg",windowClass:"mt-expedite-legacy"});f.result.then(function(t){i.updateOrCreate(u,t).then(function(){n.search()},function({data:n}){console.error(n)})},angular.noop)};n.edit=function(n){var t={data:n,action:"Edit",type:"Release"};o(t)};n.addNewReleasePo=function(){i.newReleasePO().then(function({data:n}){var t={data:n,action:"Add",type:"Release"};o(t)})};n.recalculate=function(){i.recalculate().then(function(t){e.ReleaseAmount=t.ReleaseAmount;n.grid.refresh()})};n.openDetails=function(i){r.open({templateUrl:t.WebClientPath+"/Modules/XpoNlm/Specialized/Views/ReleasePoDetailsModal.html",controller:"ReleasePoDetailsModalInstanceController",resolve:{releasePO:function(){return i},IsPOManager:function(){return n.isPOManager}},size:"lg",windowClass:"mt-expedite-legacy"}).result.then(angular.noop,angular.noop)};n.searchInProgress=!1;n.includeClosed=!1;n.includePending=!1;n.search=function(){if(n.selectedCustomer.Id){n.searchInProgress=!0;n.alertText=null;var t={releaseNumber:n.releaseNumber,startDate:n.startDate,endDate:n.endDate,includeClosed:n.includeClosed,includePending:n.includePending,customerId:n.selectedCustomer.Id};i.getReleasePOs(t).then(function({data:t}){n.searchInProgress=!1;h(t)},function({data:t}){n.searchInProgress=!1;console.error(t)})}else n.alertText="Please select a customer."}}]);xpoNlmModule.controller("TariffController",["$scope","$rootScope","$document","tariffService","customersService",function(n,t,i,r,u){function c(n,i){$('').appendTo(n).kendoDropDownList({autoBind:!1,dataTextField:"TwoDigitCode",dataValueField:"CountryCodeId",dataSource:{type:"xml",transport:{read:t.ExpediteApi+"/country"}}})}function et(t){var r={filters:n.filters},h;r.filters.ReturnList=!0;t.data.TariffId&&(r.filters.TariffId=t.data.TariffId);n.loadingTariffDetails=!0;var i=a,o=[],u=!1,s={};n.filters.TariffTypeId===1?i=a:n.filters.TariffTypeId===2?i=k:n.filters.TariffTypeId===3?i=d:n.filters.TariffTypeId===4?i=g:n.filters.TariffTypeId===5?i=nt:n.filters.TariffTypeId===6?i=tt:n.filters.TariffTypeId===7?i=it:n.filters.TariffTypeId===8&&(i=rt,u=!0,s=ut);u&&(o=["create"]);h={serverPaging:!1,serverSorting:!1,serverFiltering:!1,pageSize:20,transport:{read:function(t){n.tariffService.getTariffDetailResults(r.filters).then(function({data:n}){_.forEach(n,function(n){n.From={CountryCodeId:n.FromCountryCodeId,TwoDigitCode:n.FromCountry};n.To={CountryCodeId:n.ToCountryCodeId,TwoDigitCode:n.ToCountry}});t.success(n)},function({data:n}){t.error(n);f(n.Message)})},update:function(t){n.clearMessages();n.clearErrors();t.data.From&&(t.data.FromCountryId=t.data.From.CountryCodeId,t.data.FromCountry=t.data.From.TwoDigitCode);t.data.To&&(t.data.ToCountryId=t.data.To.CountryCodeId,t.data.ToCountry=t.data.To.TwoDigitCode);t.data.Enabled=1;n.tariffService.updateTariff(t.data).then(function({data:n}){t.success(n);e("Tariff item updated.")},function({data:n}){t.error(n);f(n.Message)})},create:function(t){t.data.TariffId=n.filters.TariffId;t.data.TariffZipId=null;n.tariffService.createTariff(t.data).then(function({data:n}){t.success(n);e("Tariff item created.")},function({data:n}){t.error(n);f(n.Message)})},error:function(n){f(n.errorThrown)},parameterMap:function(n,t){return t==="read"?JSON.stringify(r.filters):t!=="read"&&n.models?{models:kendo.stringify(n.models)}:n}},schema:s,scrollable:!0,sortable:!0,autoSync:u};$("
").appendTo(t.detailCell).kendoGrid({dataSource:h,pageable:{pageSize:15,buttonCount:1},toolbar:o,columns:i,editable:u});n.loadingTariffDetails=!1}var h=!1,o,s,v,y,p;n.tariffService=r;n.customersService=u;$(function(){n.isLoadingTariffs=!1;n.loadingCustomers=!0;n.loadingTariffDetails=!1;n.tariffs=[];n.customerList=[];n.messages=[];n.errorMessages=[];h&&(n.carrier={locationAddress:"4940 Panther Parkway",locationCity:"Seville",locationId:4526,locationName:"Panther II Transportation Inc.",locationSCACCode:"PTWT",locationState:"OH",locationZip:null},n.carrier={locationAddress:"20 MADRID AVENUE",locationCity:"POTSDAM",locationId:64278,locationName:"LAVALLE TRANSPORTATION INC TL",locationSCACCode:"LAV2",locationState:"NY",locationZip:null})});o=function(){n.filters={CustomerIdList:[],ReturnList:!0,TariffTypeId:{},CarrierId:{},EnabledOnly:{},EnteredByStaffId:null,TariffId:null}};o();var w=[{field:"CarrierName",title:"Carrier"},{field:"CustomerName",title:"Customer"},{field:"Enabled",title:"Enabled",template:"#=Enabled ? 'Yes' : 'No'#"},{field:"StaffFirstName",title:"Staff Name",template:"#if (StaffFirstName || StaffLastName) {# #=StaffFirstName# #=StaffLastName# #}#"},{field:"ExpiresDateTime",title:"Expires",template:"#if (ExpiresDateTime) {# #= moment(ExpiresDateTime).format('MM/DD/YYYY HH:mm')# #}#"}],l=[{field:"CarrierId",title:"Carrier ID"},{field:"CarrierName",title:"Carrier"},{field:"CustomerName",title:"Customer"},{field:"TariffTypeName",title:"Type"},{field:"Enabled",title:"Enabled",template:"#=Enabled ? 'Yes' : 'No'#"},{field:"StaffFirstName",title:"Staff Name",template:"#if (StaffFirstName || StaffLastName) {# #=StaffFirstName# #=StaffLastName# #}#"},{field:"ImportedDateTime",title:"Imported",template:"#if (ImportedDateTime) {# #= moment(ImportedDateTime).format('MM/DD/YYYY HH:mm')# #}#"},{field:"CarrierSubmittedDateTime",title:"Submitted",template:"#if (CarrierSubmittedDateTime) {# #= moment(CarrierSubmittedDateTime).format('MM/DD/YYYY HH:mm')# #}#"},{field:"EffectiveDateTime",title:"Effective",template:"#if (EffectiveDateTime) {# #= moment(EffectiveDateTime).format('MM/DD/YYYY HH:mm')# #}#"},{field:"TerminatedDateTime",title:"Expires",template:"#if (TerminatedDateTime) {# #= moment(TerminatedDateTime).format('MM/DD/YYYY HH:mm')# #}#"}],b=[{field:"CarrierId",title:"Carrier ID"},{field:"CarrierName",title:"Carrier"},{field:"CustomerName",title:"Customer"},{field:"TariffTypeName",title:"Type"},{field:"Enabled",title:"Enabled",template:"#=Enabled ? 'Yes' : 'No'#"},{field:"StaffFirstName",title:"Staff Name",template:"#if (StaffFirstName || StaffLastName) {# #=StaffFirstName# #=StaffLastName# #}#"},{field:"ImportedDateTime",title:"Imported",template:"#if (ImportedDateTime) {# #= moment(ImportedDateTime).format('MM/DD/YYYY HH:mm')# #}#"},{field:"CarrierSubmittedDateTime",title:"Submitted",template:"#if (CarrierSubmittedDateTime) {# #= moment(CarrierSubmittedDateTime).format('MM/DD/YYYY HH:mm')# #}#"},{field:"EffectiveDateTime",title:"Effective",template:"#if (EffectiveDateTime) {# #= moment(EffectiveDateTime).format('MM/DD/YYYY HH:mm')# #}#"},{field:"TerminatedDateTime",title:"Expires",template:"#if (TerminatedDateTime) {# #= moment(TerminatedDateTime).format('MM/DD/YYYY HH:mm')# #}#"}],a=[{field:"Rate",title:"Rate",format:"{0:c}"},{field:"ReturnRate",title:"Return Rate",format:"{0:c}"},{field:"FromLocationName",title:"From Location"},{field:"ToLocationName",title:"To Location"},{field:"CategoryName",title:"Vehicle Type"}],k=[{field:"CarrierId",title:"Carrier ID"},{field:"CategoryName",title:"Category"},{field:"CustomerName",title:"Customer"},{field:"Enabled",title:"Enabled",template:"#=Enabled ? 'Yes' : 'No'#"},{field:"StaffFirstName",title:"Staff Name",template:"#if (StaffFirstName || StaffLastName) {# #=StaffFirstName# #=StaffLastName# #}#"},{field:"FromState",title:"From State"},{field:"ToState",title:"To State"},{field:"MinimumRate",title:"Min. Rate",format:"{0:c}"},{field:"ReturnRate",title:"Return Rate",format:"{0:c}"}],d=[{field:"LessThan",title:"Less Than"},{field:"GreaterThanOrEqual",title:"Greater Than or Equal"},{field:"ModeTypeName",title:"Mode Type"},{field:"TariffZone",title:"Tariff Zone"},{field:"CustomerName",title:"Customer"},{field:"StaffFirstName",title:"Staff Name",template:"#if (StaffFirstName || StaffLastName) {# #=StaffFirstName# #=StaffLastName# #}#"},{field:"TariffTypeName",title:"Tariff Type"}],g=[{field:"Country3DigitCode",title:"Country"},{field:"ModeTypeName",title:"Mode Type"},{field:"MinimumMileage",title:"Min. Mileage"},{field:"MinimumRate",title:"Min. Rate",format:"{0:c}"},{field:"Rate",title:"Rate",format:"{0:c}"}],nt=[{field:"MinimumMileage",title:"Min. Mileage"},{field:"VehicleWeightCapacity",title:"Vehicle Wt. Capacity"},{field:"Rate",title:"Rate",format:"{0:c}"}],tt=[{field:"Country3DigitCode",title:"Country"},{field:"CategoryName",title:"Category"},{field:"VehicleMinimumWeight",title:"Min. Weight"},{field:"VehicleMinimumMiles",title:"Min. Miles"},{field:"Rate",title:"Rate",format:"{0:c}"}],it=[{field:"VehicleMinimumWeight",title:"Min. Weight"},{field:"Rate",title:"Rate",format:"{0:c}"}],rt=[{field:"From",title:"From Country",editor:c,template:"#=FromCountry#"},{field:"FromZip",title:"From 3-digit Zip"},{field:"To",title:"To Country",editor:c,template:"#=ToCountry#"},{field:"ToZip",title:"To 3-digit Zip"},{field:"Enabled",title:"Enabled",template:"#=Enabled ? 'Yes' : 'No'#"},{field:"EnteredByStaffName",title:"Staff Name"},{field:"Rate",title:"Rate",format:"{0:c}"},{field:"MinimumRate",title:"Min. Rate",format:"{0:c}"}],ut={model:{id:"TariffZipId",fields:{TariffZipId:{editable:!1,nullable:!0},FromZip:{editable:!0,nullable:!1,validation:{required:!0,min:0,max:3}},ToZip:{editable:!0,nullable:!1,validation:{required:!0,min:0,max:3}},Enabled:{editable:!1,type:"boolean"},EnteredByStaffName:{editable:!1,type:"string"},Rate:{editable:!0,type:"number",validation:{min:0,required:!0}},MinimumRate:{editable:!0,type:"number",validation:{min:0,required:!0}},From:{defaultValue:{FromCountryId:1,FromCountry:"US"}},To:{defaultValue:{ToCountryId:1,ToCountry:"US"}}}}},e=function(t){n.messages.push(t)},f=function(t){console.error("Error:"+t);n.errorMessages.push(t)},ft=function(){n.customerList=u.customers;n.loadingCustomers=!1};n.tariffTypes=[{name:"Select Tariff Type",value:null},{name:"Point-to-Point (P2P)",value:1},{name:"Zone-to-Zone (Z2Z)",value:2},{name:"3 Digit Zip-to-Zip (3D-Z2Z)",value:8},{name:"Air - Mileage",value:4},{name:"Air - Over The Counter",value:7},{name:"Air - Specials",value:5},{name:"Air - Weight",value:3},{name:"Ground - Mileage",value:6}];n.MultiSelectCustomersDefaultText={buttonDefaultText:"Customers"};n.MultiSelectTariffTypesDefaultText={buttonDefaultText:"Tariff Types"};n.editmode||(n.editmode=!0);n.clearErrors=function(){n.errorMessages=[]};n.clearMessages=function(){n.messages=[]};s=function(t,i){n.searchInProgress=!1;t.Error?n.errorMessages.push(t.Error+(i?" ("+i+") ":"")):n.errorMessages.push(t.Message+" ("+t.ExceptionMessage+") "+(i?" ("+i+") ":""))};n.selectedTariffType=n.tariffTypes[0];h&&(n.selectedTariffType=n.tariffTypes[3]);n.selectTariffType=function(t){n.selectedTariffType=t};v=function(){n.filters.TariffId=null;n.filters.CustomerIdList=_.map(n.filteredCustomers,"Id");n.filters.EnteredByStaffId=null;n.filters.ReturnList=!1;n.filters.TariffTypeId=n.selectedTariffType.value;n.carrier&&(n.filters.CarrierId=n.carrier.locationId);n.filters.EnabledOnly=n.enabledOnly?n.enabledOnly:!1};y=new kendo.data.DataSource({data:n.tariffs});n.createGrid=function(t){t=t||{};$("#grid").kendoGrid({dataSource:{data:t.data||y},autoBind:t.autobind||!1,dataBound:function(){var t=this;t.tbody.find("tr").dblclick(function(){var i=t.dataItem(this),r,u;if(i.Enabled===!1){alert("The selected tariff is already disabled.");return}confirm("Are you sure you want to disable this Tariff?")&&(n.filters.TariffTypeId===1?(r={CarrierId:i.CarrierId,CustomerId:i.CustomerId,StaffId:i.EnteredByStaffId,CreatedDateTimeFrom:i.CreatedDateTimeFrom,CreatedDateTimeTo:i.CreatedDateTimeTo,DataItem:i},n.tariffService.submitTariffDisableP2P(r,e,f),i.Enabled=!1):(u={TariffId:i.TariffId,StaffId:i.EnteredByStaffId,TariffTypeId:i.TariffTypeId,DataItem:i},n.tariffService.submitTariffDisable(u,e,f),i.Enabled=!1),$("#grid").data("kendoGrid").refresh())})},sortable:!0,navigatable:!0,selectable:"row",scrollable:{virtual:!0},columns:t.cols||[],detailInit:et})};n.refreshGrid=function(t,i){var r=$("#grid"),u;r.length>0&&r.data().kendoGrid&&(u=r.data().kendoGrid,u.dataSource&&u._refreshHandler&&(r.removeData("kendoGrid"),r.empty()));n.createGrid({autobind:!0,data:t,cols:i})};p=function(t){n.clearMessages();n.clearErrors();n.tariffCount=t.length;n.tariffs=t;var i=b;n.filters.TariffTypeId===1?i=w:n.filters.TariffTypeId===2&&(i=l);n.refreshGrid(t,i);n.displayResults=!0;n.searchInProgress=!1};n.customersService.getCustomers(ft,s);n.search=function(){n.isLoadingTariffs=!0;n.searchInProgress=!0;v();var t={filters:n.filters};r.getTariffResults(t.filters,p,s);n.clearErrors();n.selectedTariffs=[]};n.changeGrid=function(t){n.gridOptions.dataSource.data=t;n.gridOptions.columns=l};n.createGrid();n.clearAll=function(){o();n.displayResults=!1;n.isLoadingTariffs=!1;n.loadingCustomers=!1;n.tariffs=[];n.filteredCustomers={};n.carrier=[];n.selectedTariffType=n.tariffTypes[0];n.enabledOnly=!1;n.clearMessages();n.clearErrors()};n.gridRowSelect=function(t){var r=t.sender,i,u;n.selectedTariffs=[];i=[];_.forEach(r.select(),function(t){var u=r.dataItem(t);n.selectedTariffs.push(u);i.push(u.uid)});$("tr.kl-state-selected").each(function(){var n=$(this)[0].dataset.uid;_.findIndex(i,function(t){return t===n})===-1&&$(this).removeClass("kl-state-selected")});u=$(t.sender.element).closest(".kl-detail-row").prev(".kl-master-row");$(u).addClass("kl-state-selected")};angular.element(i).find("html").addClass("carrier-tariffs");n.$on("$destroy",function(){angular.element(i).find("html").removeClass("carrier-tariffs")})}]);xpoNlmModule.controller("forcePasswordChangeController",["$window","$location","$scope","userService","$rootScope",function(n,t,i,r,u){i.passwordUpdateViewModel={password:"",confirmpassword:""};i.userHasEnteredDataIntoPasswordField=!1;i.passwordFieldChanged=function(){i.userHasEnteredDataIntoPasswordField=i.passwordUpdateViewModel.password.length>0?!0:!1;i.passwordUpdateForm.Password.$setValidity("historicallyValid",!0);i.passwordUpdateForm.Password.$setValidity("doNotMatch",!0)};i.UpdateUserPassword=function(){r.forcePasswordChange(i.passwordUpdateViewModel,function(t){n.location.href=u.ServerName+t.replace(/"/g,"")},function(n,t){var r,f,u;if(t===400)for(r=0;r-1;t.passwordResetViewModel={Username:""};t.trackShipment=function(){t.shipmentToTrack&&t.locationCode&&n.open(`/WebClient/Public/#/PublicShipment/${t.shipmentToTrack}?locationCode=${t.locationCode}`,"ShipmentTracking","width=1000,height=600,scrollbars=yes,toolbar=0,menubar=0,resizable=1")};t.contactUs=function(){n.location="/WebClient/ContactUs"};t.forgotPasswordClicked=function(){i.requestUserPasswordReset(t.passwordResetViewModel,function(){t.resetPasswordSubmitted=!0},function(n,i){i==400&&n[0].FieldName==="badRequest"&&(t.usernameFound=!1)})};t.resetUserPasswordModalClosed=function(){t.resetPasswordSubmitted=!1;t.usernameFound=!0};t.redirectToContactUs=function(){n.location=`${u.ServerName}/contactus.asp`};const e=document.cookie?.split("; ");e?.forEach(n=>{const t=n.split("=")[0];t.startsWith("ASPSESSIONID")&&(document.cookie=`${t}=;domain=${window.location.hostname};path=/;expires='01 Jan 1970 00:00:00 GMT'`)})}]);xpoNlmModule.controller("PasswordResetModalController",["$window","$scope","userService","$uibModalInstance",function(){}]);xpoNlmModule.controller("userProfileController",["$window","$scope","userService",function(n,t,i){t.passwordUpdateViewModel={password:"",confirmpassword:""};t.passwordChangedSuccessfully=!1;t.userHasEnteredDataIntoPasswordField=!1;t.passwordFieldChanged=function(){t.passwordChangedSuccessfully=!1;t.userHasEnteredDataIntoPasswordField=t.passwordUpdateViewModel.password.length>0?!0:!1;t.passwordChangeForm.Password.$setValidity("historicallyValid",!0);t.passwordChangeForm.Password.$setValidity("doNotMatch",!0)};t.changePassword=function(){i.changePassword(t.passwordUpdateViewModel,function(){t.passwordChangedSuccessfully=!0},function(n,i){var r,f,u;if(i===400)for(r=0;r