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='