1(self.webpackChunkassuredFrontend=self.webpackChunkassuredFrontend||[]).push([[6270],{56270:(ht,Ge,F)=>{"use strict";F.r(Ge),F.d(Ge,{ManageModule:()=>Va});var Q=F(94666),Ie=F(42341),P=F(54744),_e=F(97155),ye=F(84505),V=F(6957),_=F(64139),U=F(19193),T=F(59095),x=F(88759),C=F(83859),O=F(47418),A=F(83910),e=F(22560),c=F(2508);class f{static checkDotNumber(l){let t=parseInt(l.value,10);return l&&isNaN(t)?{checkTypeNumber:!0}:null}static checkPassword(l){const t=l.get("supportPassword"),s=l.get("supportConfPassword");return t&&s&&t.value!==s.value?{checkpassword:!0}:null}}var u=F(4695),n=F(17650);class g{}var b=F(49392),I=F(93625),S=F(44761),p=F(88044),y=F(10093),N=F(35849);function D(r,l){if(1&r&&(e.TgZ(0,"option",50),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function h(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function M(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.onlyNumbers)}}function q(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.numberChar)}}function J(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.errorMaxMinDOT)}}function R(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",52)(1,"button",53),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.GetCarrierInfo(i.DotNumber.value))}),e._UZ(2,"i",54),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.locales.validateInfo),e.Q6J("disabled",t.DotNumber.invalid||0===(null==t.DotNumber?null:t.DotNumber.value.length))}}function k(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function B(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.carrier_name_validation)}}function X(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.check_alfaNumeric)}}function de(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.please_fill_carrier_name)}}function oe(r,l){if(1&r&&(e.TgZ(0,"span",51),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.check_alfaNumeric)}}function me(r,l){if(1&r&&(e.TgZ(0,"option",50),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function ne(r,l){if(1&r&&(e.TgZ(0,"option",50),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function ce(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",58)(1,"button",59),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return e.KtG(i.generateApiKey())}),e._uU(2),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(2),e.Oqu(t.locales.generate)}}function ae(r,l){if(1&r&&(e.TgZ(0,"div",11)(1,"label",55),e._uU(2),e.qZA(),e.TgZ(3,"div",9)(4,"div"),e._UZ(5,"input",56),e.qZA(),e.YNc(6,ce,3,1,"div",57),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.Oqu(t.locales.api_key),e.xp6(2),e.Tol(1===t.carrierPermission&&t.loginUser||!t.loginUser||t.loginUser&&(6===t.loginUser.HOSUserTypeId||7===t.loginUser.HOSUserTypeId)?"col-sm-9":"col-sm-12"),e.xp6(1),e.s9C("placeholder",t.locales.api_key),e.xp6(1),e.Q6J("ngIf",1===t.carrierPermission&&t.loginUser||!t.loginUser||t.loginUser&&(6===t.loginUser.HOSUserTypeId||7===t.loginUser.HOSUserTypeId))}}function Ae(r,l){if(1&r&&(e.TgZ(0,"div",11)(1,"label",55),e._uU(2),e.qZA(),e._UZ(3,"input",60),e.qZA()),2&r){const t=e.oxw();e.xp6(2),e.Oqu(t.locales.platform_token),e.xp6(1),e.s9C("placeholder",t.locales.platform_token)}}function Te(r,l){if(1&r&&(e.TgZ(0,"div",11)(1,"div",36),e._UZ(2,"input",61),e.TgZ(3,"label",62),e._uU(4),e.qZA()()()),2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.engine_diagnostic)}}function Ce(r,l){if(1&r&&(e.TgZ(0,"div",11)(1,"div",36),e._UZ(2,"input",63),e.TgZ(3,"label",64),e._uU(4),e.qZA()()()),2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.ecm_automatic)}}function Ue(r,l){if(1&r&&(e.TgZ(0,"div",11)(1,"div",36),e._UZ(2,"input",65),e.TgZ(3,"label",66),e._uU(4),e.qZA()()()),2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.canadaEnabled)}}function Ne(r,l){if(1&r&&(e.TgZ(0,"div",11)(1,"div",36),e._UZ(2,"input",67),e.TgZ(3,"label",68),e._uU(4),e.qZA()()()),2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.enableWorkOrder)}}function ue(r,l){if(1&r&&(e.TgZ(0,"div",11)(1,"div",36),e._UZ(2,"input",69),e.TgZ(3,"label",70),e._uU(4),e.qZA()()()),2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.enableEnhancedIFTA)}}function Ye(r,l){if(1&r&&(e.TgZ(0,"option",50),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function qe(r,l){1&r&&(e.TgZ(0,"small",74),e._uU(1," Changing to Inactive or Closed will deactivate all drivers. "),e.qZA())}function Ze(r,l){1&r&&(e.TgZ(0,"small",75),e._UZ(1,"span",76),e._uU(2," Updating status... "),e.qZA())}function Ke(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",25)(1,"div",10)(2,"div",11)(3,"label"),e._uU(4,"Carrier Status"),e.qZA(),e.TgZ(5,"select",71),e.NdJ("change",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.onStatusChange())}),e.YNc(6,Ye,2,2,"option",18),e.qZA(),e.YNc(7,qe,2,0,"small",72),e.YNc(8,Ze,3,0,"small",73),e.qZA()()()}if(2&r){const t=e.oxw();e.xp6(6),e.Q6J("ngForOf",t.carrierStatusOptions),e.xp6(1),e.Q6J("ngIf",!t.statusUpdating),e.xp6(1),e.Q6J("ngIf",t.statusUpdating)}}function Xe(r,l){if(1&r&&(e.TgZ(0,"div",77)(1,"button",78),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",79),e._uU(5),e.qZA(),e._UZ(6,"div",80),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.Q6J("innerHTML",t.formState.message,e.oJD)}}function Qe(r,l){1&r&&e._UZ(0,"span",84)}function ii(r,l){if(1&r&&(e.TgZ(0,"span",85),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.loading)}}function si(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",81),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();
1return e.KtG(i.submitForm())}),e.YNc(1,Qe,1,0,"span",82),e.YNc(2,ii,2,1,"span",83),e._uU(3),e.qZA()}if(2&r){const t=e.oxw();e.Q6J("disabled",t.carrierForm.invalid||t.formState.loading||!t.carrierForm.dirty&&!t.APIkeygeneraded||""===(null==t.DotNumber?null:t.DotNumber.value)),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.hij(" ",t.locales.save," ")}}const et=function(r){return{"is-invalid":r}};let tt=(()=>{class r{constructor(t,s,i,o,a,d,m,v,Z){this.fb=t,this.activeModal=s,this.utilService=i,this.carrierService=o,this.confirmDialogService=a,this.eventBus=d,this.authService=m,this.hosService=v,this.toast=Z,this.onSubmit=new e.vpe,this.useValidatedInfo=!1,this.createCarrier=!1,this.DOTNumberchanged=!0,this.APIkeygeneraded=!1,this.requiredElement=!1,this.timeZones=[],this.fuelUnitCodes=[],this.selectChanged=!1,this.nameLoaded="",this.addressLoaded="",this.countryLoaded=1,this.oneEmpty=!1,this.error500=!1,this.hide=!0,this.inputTextLength=0,this.statusUpdating=!1,this.carrierStatusOptions=[{label:"Active",key:1},{label:"Suspended",key:2},{label:"Inactive",key:3},{label:"Closed",key:4}],this.carrierValidator={dotNumberError:!1,carrierNameError:!1,carrierAddressError:!1,status:"invalid"},this.countries=[{key:1,label:"USA"},{key:2,label:"Canada"},{key:3,label:"Mexico"}],this.carrierSub=new V.w,this.isLettersAndNumbers=H=>/^[a-z0-9]*$/i.test(H)}ngDoCheck(){if(this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close(),this.carrierForm.valueChanges){if(this.isNonEmptyString(this.SupportUserName.value)?(this.SupportPassword.enabled||(this.SupportPassword.enable(),this.requiredElement=!0),!this.SupportConfirmPassword.enabled&&this.carrier.SupportPassword!=this.SupportPassword.value&&(this.SupportConfirmPassword.enable(),this.requiredElement=!0)):(this.SupportPassword.enabled&&(this.SupportPassword.disable(),this.requiredElement=!1),this.SupportConfirmPassword.enabled&&(this.SupportConfirmPassword.disable(),this.requiredElement=!1)),this.useValidatedInfo){this.Name.setValue(this.carrierVerifyName),this.Name.disable(),this.Address.setValue(this.carrierVerifyAdd),this.Address.disable();let t=this.countries.find(s=>s.label===this.carrierVerifyCountry);this.Country.setValue(t.key),this.Country.disable(),this.useValidatedInfo=!1}this.checkDOTNumber()}}ngOnDestroy(){$(".select2-container").removeClass("select2-container--open"),$("#country").remove(),$("#timeZoneCode").remove(),$("#fuelUnitCode").remove(),this.carrierSub.unsubscribe()}ngAfterViewInit(){function t(s){return"1"===s.id?$('<span><img src="../../../assets/img/flags/usa.png"> USA</span>'):"2"===s.id?$('<span><img src="../../../assets/img/flags/canada.png"> Canada</span>'):$('<span><img src="../../../assets/img/flags/mexico.png"> Mexico</span>')}$("#country").select2({templateResult:t,templateSelection:t}),$("#timeZoneCode").select2(),$("#fuelUnitCode").select2(),$("#country").on("change",s=>{this.carrierForm.get("country").setValue(s.target.value),this.carrierForm.markAsDirty()}),$("#timeZoneCode").on("change",s=>{this.carrierForm.get("timeZoneCode").setValue(s.target.value),this.carrierForm.markAsDirty()}),$("#fuelUnitCode").on("change",s=>{this.carrierForm.get("fuelUnitCode").setValue(s.target.value),this.carrierForm.markAsDirty()})}ngOnInit(){this.loginUser=this.hosService.loginUser,this.loginUser&&this.getCarrierModelPermission(),this.fuelUnitCodes=this.utilService.fuelUnitCodes,this.fuelUnitCodes[0].label=this.locales.miles_gallons,this.fuelUnitCodes[1].label=this.locales.km_liters,this.carrierCountry=this.carrier.CarrierCountry,this.timeZones=this.utilService.Timezones,(0,_.of)(this.authService.appReseller).subscribe(s=>{this.reseller=s}).unsubscribe(),this.carrierForm=this.fb.group({dotNumber:[this.carrier.CarrierId,[c.kI.required,c.kI.min(1),c.kI.max(999999999)]],name:[{value:this.carrier.CarrierName,disabled:1===this.carrier.CarrierPropInUse},[c.kI.required,c.kI.minLength(4),c.kI.maxLength(120),u.s.checkNameAndAddress]],address:[{value:this.carrier.CarrierAddress,disabled:1===this.carrier.CarrierPropInUse}
1,[c.kI.required,c.kI.maxLength(150),u.s.checkNameAndAddress]],country:[{value:this.carrierCountry,disabled:1===this.carrier.CarrierPropInUse}],timeZoneCode:[this.carrier.TimeZoneCode],fuelUnitCode:[this.carrier.FuelUnitCode],apiKey:[{value:this.carrier.ApiKey,disabled:!0}],platformToken:[this.carrier.PlatformToken],dtcCodes:[{value:!!this.carrier.DTCCodes,disabled:this.enableDTCCodes}],activateDriver:[{value:!!this.carrier.ActivateDriver,disabled:!this.enableByRole}],ecmAutomatic:[{value:!!this.carrier.ECMAutomatic,disabled:!this.enableByRole}],ecmLinkConnection:[{value:!!this.carrier.ForceECMLinkConnection,disabled:!this.enableByRole}],forceAssetSelection:[!!this.carrier.ForceAssetSelection],supportUsername:[{value:this.carrier.SupportUserName,disabled:2===this.formType&&""!==this.carrier.SupportUserName},[c.kI.minLength(4),c.kI.maxLength(50),u.s.checkUsername]],supportPassword:[{value:this.carrier.SupportPassword,disabled:this.isNonEmptyString(this.carrier.SupportUserName)}],supportConfPassword:[{value:this.carrier.SupportPassword,disabled:this.isNonEmptyString(this.carrier.SupportUserName)}],canadaEnabled:[{value:!!this.carrier.CanadaEnabled,disabled:this.enableCanadaBit}],workorderEnabled:[{value:this.carrier.WorkOrderEnabled,disabled:!this.enableWorkOrderBit()}],enhancedIFTAEnabled:[{value:this.carrier.EnhancedIFTAEnabled,disabled:!this.enableEnhancedIFTABit()}],aiVisionEnabled:[{value:!!this.carrier.AIVisionEnabled,disabled:!this.enableAIVisionBit()}],carrierStatus:[{value:this.carrier.Status||1,disabled:!this.enableStatusChange()}]},{validators:[f.checkPassword]}),this.forceAsset=1==this.carrier.ForceECMLinkConnection,1===this.carrier.CarrierPropInUse&&this.loadCarrierInfoData(),2===this.carrierPermission&&this.loginUser&&6!==this.loginUser.HOSUserTypeId&&7!==this.loginUser.HOSUserTypeId&&this.carrierForm.disable()}checkDOTNumber(){return this.isLettersAndNumbers(this.DotNumber.value)?1==+this.Country.value&&/[a-zA-Z]/g.test(this.DotNumber.value)?this.DotNumber.setErrors({checkDOTNumber:!0}):this.DotNumber.setErrors(null):this.DotNumber.setErrors({checkDOTNumber:!0}),null}getCarrierModelPermission(){this.carrierPermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>1===s)?1:2,this.inputTextLength=1===this.formType?0:this.carrier.CarrierAddress.length}loadCarrierInfoData(){this.nameLoaded=this.Name.value,this.addressLoaded=this.Address.value,this.countryLoaded=+this.Country.value}get SupportUserName(){return this.carrierForm.get("supportUsername")}get SupportPassword(){return this.carrierForm.get("supportPassword")}get SupportConfirmPassword(){return this.carrierForm.get("supportConfPassword")}checkPasswords(){return this.SupportPassword===this.SupportConfirmPassword}isNonEmptyString(t){return t&&t.length>0}get enableByRole(){return 2===this.role||3===this.role||4===this.role}get enableDTCCodes(){return!(1===this.reseller_DTCEnabled&&2===this.role&&0==+this.carrier.DTCCodes)}get enableCanadaBit(){return!(1===this.reseller_CanadaEnabled&&2===this.role&&0==+this.carrier.CanadaEnabled)}keyPressAlphaNumeric(t){let s=String.fromCharCode(t.keyCode);return!!/[a-zA-Z0-9]/.test(s)||(t.preventDefault(),!1)}enableWorkOrderBit(){switch(this.role){case 1:case 4:return!1;case 2:return 1===this.reseller.WorkOrderEnabled&&0===this.carrier.WorkOrderEnabled;case 3:return 0===this.carrier.WorkOrderEnabled}}enableEnhancedIFTABit(){switch(this.role){case 1:case 4:return!1;case 2:return 1===this.reseller.EnhancedIFTAEnabled&&0===this.carrier.EnhancedIFTAEnabled;case 3:return 1===this.carrier.EnhancedIFTAEnabled}}enableAIVisionBit(){switch(this.role){case 1:case 4:default:return!1;case 2:case 3:return 1===this.reseller?.AIVisionEnabled}}enableStatusChange(){if(1===this.formType)return!1;switch(this.role){case 2:case 3:return!0;default:return!1}}getStatusLabel(t){const s=this.carrierStatusOptions.find(i=>i.key===t);return s?s.label:"Unknown"}onStatusChange(){const t=+this.CarrierStatus.value,s=this.carrier.Status||1;if(t===s)return;const i=this.getStatusLabel(t);let a=`Change carrier status from <b>${this.getStatusLabel(s)}</b> to <b>${i}</b>?`;3===t||4===t?a+="<br/><br/><b>Warning:</b> This will deactivate all drivers and log them out.":(3===s||4===s)&&(1===t||2===t)&&(a+="<br/><br/>This will reactivate all previously deactivated drivers."),this.confirmDialogService.confirm("Confirm Status Change",a).then(d=>{d?(this.statusUpdating=!0,this.carrierService.updateCarrierStatus(this.carrier.HOSClientId,t).subscribe(m=>{this.statusUpdating=!1,1===m.code?(this.carrier.Status=t,this.toast.success(`Carrier status updated to ${i}`,{duration:3e3,dismissible:!0})):(this.CarrierStatus.setValue(s),this.toast.error(m.data||"Failed to update status",{style:this.utilService.errorStyleMsg,duration:3e3,dismissible:!0}))},()=>{this.statusUpdating=!1,this.CarrierStatus.setValue(s),this.toast.error("Error updating carrier status",{style:this.utilService.errorStyleMsg,duration:3e3,dismissible:!0})}
1)):this.CarrierStatus.setValue(s)}).catch(()=>{this.CarrierStatus.setValue(s)})}get CarrierStatus(){return this.carrierForm.get("carrierStatus")}get DotNumber(){return this.carrierForm.get("dotNumber")}get Name(){return this.carrierForm.get("name")}get Address(){return this.carrierForm.get("address")}get Country(){return this.carrierForm.get("country")}get ApiKey(){return this.carrierForm.get("apiKey")}get PlatformToken(){return this.carrierForm.get("platformToken")}get DTCCodes(){return this.carrierForm.get("dtcCodes")}get ActivateDriver(){return this.carrierForm.get("activateDriver")}get ECMAutomatic(){return this.carrierForm.get("ecmAutomatic")}get ForceAsset(){return this.carrierForm.get("forceAssetSelection")}get CanadaEnabled(){return this.carrierForm.get("canadaEnabled")}get EnhancedIFTAEnabled(){return this.carrierForm.get("enhancedIFTAEnabled")}get WorkorderEnabled(){return this.carrierForm.get("workorderEnabled")}get EcmLinkConnection(){return this.carrierForm.get("ecmLinkConnection")}get TimeZoneCode(){return this.carrierForm.get("timeZoneCode")}get AiVision(){return this.carrierForm.get("aiVisionEnabled")}required(t){return this.carrierForm.get(`${t}`).hasError("required")&&(this.carrierForm.get(`${t}`).touched||2===this.formType)}onValueAdd(t,s){let i=t.trim();this.carrierForm.get(`${s}`).setValue(i),"dotNumber"===s&&(this.carrierInfo=new g,this.carrier.CarrierPropInUse=0,this.Name.enable(),this.Address.enable(),this.Country.enable()),"address"===s&&(this.inputTextLength=this.Address.value.length)}getRemainingText(){this.inputTextLength=this.Address.value.length}findCountry(t){return this.countries.find(s=>s.key===t)}submitForm(){let t=this.carrierForm.value,s=this.carrierService.getPristineCarrier(),i="";
1if(this.carrierForm.invalid&&(i=this.locales.invalidForm+"<br/>"),!this.findCountry(+t.country)&&1!==this.carrier.CarrierPropInUse&&(i+=this.locales.invalidCountry+"<br/>"),this.utilService.findTimeZone(+t.timeZoneCode)||(i+=this.locales.invalidTimeZone+"<br/>"),this.utilService.findFuelUnitCode(+t.fuelUnitCode)||(i+=this.locales.invalidUnits+"<br/>"),0===this.carrier.CarrierPropInUse&&1==+this.Country.value&&(i+=this.locales.beforeSubmitCarrierForm+"<br/>"),2===this.formType&&""!==this.carrier.SupportUserName&&this.carrier.SupportUserName!==this.SupportUserName.value&&(i+=this.locales.supportUsernameChanged+"<br/>"),""===this.DotNumber?.value&&(i+=this.locales.errorMaxMinDOT+"<br/>"),""!==i)this.formState={loading:!1,submited:!1,errors:!0,message:i};else{switch(s.index=5===this.authService.appCredentials.partnerId&&1===this.formType?this.hosService.carriers&&this.hosService.carriers.length>0?this.hosService.carriers[this.hosService.carriers.length-1].index+1:0:this.carrier.index,s.AccountType=this.carrier.AccountType,s.ApiKey=this.ApiKey.value,s.ExternalClientId=5===this.authService.appCredentials.partnerId?0:this.carrier.ExternalClientId,3===this.role||4===this.role?(s.HOSBillingId=this.hosService.moaForUser?.length>0&&1===this.formType?this.hosService.moaForUser[0].HOSBillingId:this.carrier.HOSBillingId,s.HOSAccountId=this.hosService.moaForUser?.length>0&&1===this.formType?this.hosService.moaForUser[0].HOSAccountId:this.carrier.HOSAccountId):(s.HOSBillingId=5===this.authService.appCredentials.partnerId?this.reseller.HOSBillingId:this.carrier.HOSBillingId,s.HOSAccountId=this.loginUser&&9===this.loginUser.HOSUserTypeId||this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:this.carrier.HOSAccountId),s.HOSClientId=this.carrier.HOSClientId,s.HOSPartnerId=5===this.authService.appCredentials.partnerId?5:this.carrier.HOSPartnerId,s.Name=this.carrier.Name,s.PlatformToken=this.pToken&&this.enableByRole?t.platformToken:this.carrier.PlatformToken,1===this.carrier.CarrierPropInUse?(s.CarrierName=this.carrierForm.get("name").value,s.CarrierAddress=this.carrierForm.get("address").value,s.CarrierCountry=-1!==this.countryLoaded?this.countryLoaded:+t.country):(s.CarrierName=t.name,s.CarrierAddress=t.address,s.CarrierCountry=+t.country),s.CarrierId=t.dotNumber,s.SupportUserName=2===this.formType&&""!==this.carrier.SupportUserName?this.carrier.SupportUserName:t.supportUsername,s.SupportPassword=t.supportPassword,s.TimeZoneCode=+t.timeZoneCode,s.FuelUnitCode=+t.fuelUnitCode,s.DistanceUnitCode=+t.fuelUnitCode,s.CarrierPropInUse=1==+this.Country.value?this.carrier.CarrierPropInUse:3,5===this.authService.appCredentials.partnerId&&(s.Name=s.CarrierName),this.role){case 1:case 4:s.WorkOrderEnabled=this.carrier.WorkOrderEnabled,s.EnhancedIFTAEnabled=this.carrier.EnhancedIFTAEnabled,s.DTCCodes=this.carrier.DTCCodes,s.ForceECMLinkConnection=this.carrier.ForceECMLinkConnection,s.ECMAutomatic=1===this.reseller.ShowAutomaticDriving?this.carrier.ECMAutomatic:1,s.ActivateDriver=this.carrier.ActivateDriver,s.CanadaEnabled=this.carrier.CanadaEnabled,s.FMCSAEmail=this.carrier.FMCSAEmail,s.FMCSADisplayName=this.carrier.FMCSADisplayName,s.FMCSASmtpHost=this.carrier.FMCSASmtpHost,s.FMCSASmtpPort=this.carrier.FMCSASmtpPort,s.FMCSASmtpUser=this.carrier.FMCSASmtpUser,s.FMCSASmtpPassword=this.carrier.FMCSASmtpPassword,s.FMCSAOtpValidatedOn=this.carrier.FMCSAOtpValidatedOn,s.FMCSAOtpValidated=this.carrier.FMCSAOtpValidated,s.AIVisionEnabled=this.carrier.AIVisionEnabled;break;case 2:s.EnhancedIFTAEnabled=1===this.reseller.EnhancedIFTAEnabled?0===this.carrier.EnhancedIFTAEnabled?+t.enhancedIFTAEnabled:1:this.carrier.EnhancedIFTAEnabled,s.WorkOrderEnabled=1===this.reseller.WorkOrderEnabled?0===this.carrier.WorkOrderEnabled?+t.workorderEnabled:1:this.carrier.WorkOrderEnabled,s.DTCCodes=1===this.reseller.DTCEnabled?0===this.carrier.DTCCodes?+t.dtcCodes:1:this.carrier.DTCCodes,s.CanadaEnabled=1===this.reseller.CanadaEnabled?1===this.carrier.CanadaEnabled?1:+this.CanadaEnabled.value:this.carrier.CanadaEnabled,s.AIVisionEnabled=+this.AiVision.value,s.ForceECMLinkConnection=+t.ecmLinkConnection,s.ECMAutomatic=1===this.reseller.ShowAutomaticDriving?+t.ecmAutomatic:1,s.ActivateDriver=+t.activateDriver,s.FMCSAEmail=this.carrier.FMCSAEmail,s.FMCSADisplayName=this.carrier.FMCSADisplayName,s.FMCSASmtpHost=this.carrier.FMCSASmtpHost,s.FMCSASmtpPort=this.carrier.FMCSASmtpPort,s.FMCSASmtpUser=this.carrier.FMCSASmtpUser,s.FMCSASmtpPassword=this.carrier.FMCSASmtpPassword,s.FMCSAOtpValidatedOn=this.carrier.FMCSAOtpValidatedOn,s.FMCSAOtpValidated=this.carrier.FMCSAOtpValidated,s.AIVisionEnabled=this.carrier.AIVisionEnabled;break;case 3:s.EnhancedIFTAEnabled=0===this.carrier.EnhancedIFTAEnabled?0:+this.EnhancedIFTAEnabled.value,s.WorkOrderEnabled=0===this.carrier.WorkOrderEnabled?0:+this.WorkorderEnabled.value,s.DTCCodes=0===this.carrier.DTCCodes?0:+this.DTCCodes.value,s.AIVisionEnabled=+this.AiVision.value,s.CanadaEnabled=+this.CanadaEnabled.value,s.ForceECMLinkConnection=+this.EcmLinkConnection.value,s.ECMAutomatic=1===this.reseller.ShowAutomaticDriving?+this.ECMAutomatic.value:1,s.ActivateDriver=+this.ActivateDriver.value,s.FMCSAEmail=this.carrier.FMCSAEmail,s.FMCSADisplayName=this.carrier.FMCSADisplayName,s.FMCSASmtpHost=this.carrier.FMCSASmtpHost,s.FMCSASmtpPort=this.carrier.FMCSASmtpPort,s.FMCSASmtpUser=this.carrier.FMCSASmtpUser,s.FMCSASmtpPassword=this.carrier.FMCSASmtpPassword,s.FMCSAOtpValidatedOn=this.carrier.FMCSAOtpValidatedOn,s.FMCSAOtpValidated=this.carrier.FMCSAOtpValidated,s.AIVisionEnabled=this.carrier.AIVisionEnabled;break;default:s.WorkOrderEnabled=this.carrier.WorkOrderEnabled,s.EnhancedIFTAEnabled=this.carrier.EnhancedIFTAEnabled,s.DTCCodes=this.carrier.DTCCodes,s.ForceECMLinkConnection=this.carrier.ForceECMLinkConnection,s.ECMAutomatic=1===this.reseller.ShowAutomaticDriving?this.carrier.ECMAutomatic:1,s.ActivateDriver=this.carrier.ActivateDriver,s.CanadaEnabled=this.carrier.CanadaEnabled,s.AIVisionEnabled=+this.AiVision.value,s.FMCSAEmail=this.carrier.FMCSAEmail,s.FMCSADisplayName=this.carrier.FMCSADisplayName,s.FMCSASmtpHost=this.carrier.FMCSASmtpHost,s.FMCSASmtpPort=this.carrier.FMCSASmtpPort,s.FMCSASmtpUser=this.carrier.FMCSASmtpUser,s.FMCSASmtpPassword=this.carrier.FMCSASmtpPassword,s.FMCSAOtpValidatedOn=this.carrier.FMCSAOtpValidatedOn,s.FMCSAOtpValidated=this.carrier.FMCSAOtpValidated,s.AIVisionEnabled=this.carrier.AIVisionEnabled}s.ForceAssetSelection=+t.forceAssetSelection,s.Status=this.carrier.Status||1,this.onSubmit.emit(s)}}generateApiKey(){this.APIkeygeneraded=!0,this.ApiKey.setValue(this.utilService.generateToken())}generatePlatformToken(){this.PlatformToken.setValue(this.utilService.generateToken())}GetCarrierInfo(t){this.formState.errors=!1,this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.DotNumber.valid&&this.DotNumber?.value.length>0?this.carrierSub.add(this.carrierService.GetCarrierInfo(t).subscribe(s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:i,data:o}=s.d;if(1===i){this.Name.enable(),this.Address.enable();let a=""!==o.phyStreet?o.phyStreet+", ":"",d=""!==o.phyCity?o.phyCity+", ":"",m=""!==o.phyState?o.phyState+", ":"",v=""!==o.phyZipcode?o.phyZipcode:"",Z=""!==o.phyCountry?o.phyCountry:"";if(this.carrier.CarrierName!==o.dbaName&&this.carrier.CarrierName!==o.legalName||this.carrier.CarrierAddress!==a+d+m+v||this.carrier.CarrierCountry!==this.getFormatCountry(o.phyCountry,1)){this.carrierForm.markAsDirty(),this.carrierInfo=new g,this.carrierInfo=o,this.nameLoaded=this.carrierInfo.dbaName?this.carrierInfo.dbaName:this.carrierInfo.legalName,this.addressLoaded=a+d+m+v,this.countryLoaded=""!==Z?this.getFormatCountry(this.carrierInfo.phyCountry,1):-1;let w=`<span> ${this.locales.confirmationTextCarrierInfo}
1 </span> <br/>\n <label> ${this.locales.dotnscNumber}: </label> <span> ${this.carrierInfo.dotNumber} </span>\n <label> ${this.locales.carrier_name}: </label> ${""!==this.nameLoaded?this.nameLoaded:this.locales.notFound} </span>\n <label> ${this.locales.carrier_address}: </label> ${""!==this.addressLoaded?this.addressLoaded:this.locales.notFound} </span>\n <label> ${this.locales.country}: </label> <span> ${""!==Z?this.getFormatCountry(this.carrierInfo.phyCountry,2):this.locales.notFound} </span> `;this.confirmDialogService.confirm(this.locales.pleaseConfirm,w).then(L=>{L?(this.carrier.CarrierPropInUse=1,this.Name.setValue(this.carrierInfo.dbaName?this.carrierInfo.dbaName:this.carrierInfo.legalName),this.Name.markAllAsTouched(),""!==this.nameLoaded&&this.Name.valid&&this.Name.disable(),this.Address.setValue(this.addressLoaded),this.Address.markAllAsTouched(),this.inputTextLength=this.Address.value.length,""!==a&&""!==d&&""!==m&&""!==v&&this.Address.valid&&this.Address.disable(),-1!==this.countryLoaded&&this.Country.disable(),this.Country.setValue(-1===this.countryLoaded?1:this.countryLoaded),$("#country").val(-1===this.countryLoaded?1:this.countryLoaded).trigger("change"),(""===this.nameLoaded||""===a||""===d||""===m||""===v||-1===this.countryLoaded)&&(this.carrier.CarrierPropInUse=2,this.Name.enable(),this.Address.enable(),this.Country.enable())):(1===this.carrier.CarrierPropInUse&&(this.Name.enable(),this.Address.enable(),this.Country.enable()),this.carrier.CarrierPropInUse=2)}).catch(()=>console.log())}else this.toast.info(this.locales.sameCarrierInfo,{style:this.utilService.infoStyleMsg,duration:3e3,dismissible:!0}),this.carrierInfo=new g,this.carrierInfo=o,this.carrier.CarrierPropInUse=1,this.Name.setValue(this.carrierInfo.dbaName?this.carrierInfo.dbaName:this.carrierInfo.legalName),this.Address.setValue(this.addressLoaded),this.Country.setValue(-1===this.countryLoaded?1:this.countryLoaded),$("#country").val(-1===this.countryLoaded?1:this.countryLoaded).trigger("change"),this.Name.markAllAsTouched(),this.Address.markAllAsTouched(),this.Name.valid&&this.Name.disable(),this.Address.valid&&this.Address.disable(),this.Country.disable()}else this.toast.error(this.locales.notCarrierInfo,{style:this.utilService.errorStyleMsg,duration:3e3,dismissible:!0}),1===this.carrier.CarrierPropInUse?this.carrier.CarrierPropInUse=1:(this.carrier.CarrierPropInUse=3,this.Name.enable(),this.Address.enable(),this.Country.enable())},()=>{setTimeout(()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))},200),this.toast.error(this.locales.generalError,{style:this.utilService.errorStyleMsg,duration:3e3,dismissible:!0}),1===this.carrier.CarrierPropInUse?this.carrier.CarrierPropInUse=1:(this.carrier.CarrierPropInUse=3,this.Name.enable(),this.Address.enable(),this.Country.enable())})):this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}getFormatCountry(t,s){let i=0,o="";switch(t){case"US":i=this.countries[0].key,o=this.countries[0].label;break;case"CA":i=this.countries[1].key,o=this.countries[1].label;break;case"MX":i=this.countries[2].key,o=this.countries[2].label}return 1===s?i:o}hideShow(){this.hide=!this.hide}containAnyLetter(){this.countries=[{key:1,label:"USA"},{key:2,label:"Canada"},{key:3,label:"Mexico"}],""===this.DotNumber.value?this.countries=[{key:1,label:"USA"},{key:2,label:"Canada"},{key:3,label:"Mexico"}]:/[a-zA-Z]/g.test(this.DotNumber.value)?(this.countries=this.countries.filter(s=>1!==s.key),1===this.formType?this.Country.setValue(2):(this.Country.setValue(1===this.carrier.CarrierCountry?2:this.carrier.CarrierCountry),console.log(this.Country.value),console.log(this.carrier.CarrierCountry),$("#country").val(1===this.carrier.CarrierCountry?2:this.carrier.CarrierCountry).trigger("change"),console.log($("#country").val()))):(this.Country.setValue(1),this.countries=this.countries.filter(s=>2!==s.key))}test(){console.log(this.DotNumber.value)}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(c.QS),e.Y36(P.Kz),e.Y36(b.f),e.Y36(I.V),e.Y36(S.O),e.Y36(n.Yd),e.Y36(p.e),e.Y36(y.T),e.Y36(N.jE))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["carrier-modal-form"]],inputs:{carrier:"carrier",locales:"locales",pToken:"pToken",role:"role",reseller_CanadaEnabled:"reseller_CanadaEnabled",reseller_DTCEnabled:"reseller_DTCEnabled",formState:"formState",formType:"formType"},outputs:{onSubmit:"onSubmit"},decls:141,vars:61,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["id","carrierForm","role","form","novalidate","",3,"formGroup","ngSubmit"],["ngbAutofocus","",1,"card-body"],[1,"card","border-dark","mb-3",2,"width","100%"],[1,"card-body","text-dark","my_card-body"],[1,"row"],[1,"col-md-6"],[1,"form-group"],[1,"col-7"],[1,"required-asterisk"],[1,"col-5"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["formControlName","country","id","country",1,"form-control","select2",2,"width","100%"],[3,"value",4,"ngFor","ngForOf"],[1,"col-8"],["for","CarrierId"],[1,"col-4"],["type","text","formControlName","dotNumber","minlength","1","maxlength","9","oninput","this.value = this.value.toUpperCase()","required","",1,"form-control",3,"ngClass","placeholder","change","keypress"],["class","error invalid-feedback",4,"ngIf"],["class","col-md-2",4,"ngIf"],[1,"row",2,"margin-top","10px"],[1,"col-6"],["type","text","formControlName","name","minlength","1","maxlength","120","required","",1,"form-control",3,"ngClass","placeholder","change"],["for","CarrierAddress"],["formControlName","address","maxlength","150","required","",1,"form-control",3,"ngClass","placeholder","change","input"],[1,"remaining"],["formControlName","timeZoneCode","id","timeZoneCode",1,"form-control","select2",2,"width","100%"],["formControlName","fuelUnitCode","id","fuelUnitCode",1,"form-control","select2",2,"width","100%"],[1,"col-md-8"],["class","form-group",4,"ngIf"],[1,"col-12"],[1,"form-check"],["type","checkbox","formControlName","activateDriver",1,"form-check-input"],["for","ActivateDriver",1,"form-check-label"],["type","checkbox","id","ecmLinkConnection","formControlName","ecmLinkConnection",1,"form-check-input"],["for","ecmLinkConnection",1,"form-check-label"],["type","checkbox","id","forceAssetSelection","formControlName","forceAssetSelection",1,"form-check-input"],["for","forceAssetSelection",1,"form-check-label"],["type","checkbox","id","aiVisionEnabled","formControlName","aiVisionEnabled",1,"form-check-input"],["for","aiVisionEnabled",1,"form-check-label"],["class","row","style","margin-top: 10px;",4,"ngIf"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"modal-footer"],["type","button","class","btn btn-primary",3,"disabled","click",4,"ngIf"],["type","button",1,"btn","btn-outline-dark",3,"click"],[3,"value"],[1,"error","invali
1d-feedback"],[1,"col-md-2"],["type","button",1,"btn","btn-info",3,"disabled","title","click"],[1,"fa","fa-check"],["for","ApiKey"],["type","text","formControlName","apiKey",1,"form-control",3,"placeholder"],["class","col-sm",4,"ngIf"],[1,"col-sm"],["type","button",1,"btn","btn-info",3,"click"],["type","text","formControlName","platformToken",1,"form-control",3,"placeholder"],["type","checkbox","formControlName","dtcCodes",1,"form-check-input"],["for","DTCCodes",1,"form-check-label"],["type","checkbox","formControlName","ecmAutomatic",1,"form-check-input"],["for","ECMAutomatic",1,"form-check-label"],["type","checkbox","id","canadaEnabled","formControlName","canadaEnabled",1,"form-check-input"],["for","canadaenabled",1,"form-check-label"],["type","checkbox","id","workorderEnabled","formControlName","workorderEnabled",1,"form-check-input"],["for","workorderEnabled",1,"form-check-label"],["type","checkbox","id","enhancedIFTAEnabled","formControlName","enhancedIFTAEnabled",1,"form-check-input"],["for","enhancedIFTAEnabled",1,"form-check-label"],["formControlName","carrierStatus",1,"form-control",3,"change"],["class","form-text text-muted",4,"ngIf"],["class","form-text text-info",4,"ngIf"],[1,"form-text","text-muted"],[1,"form-text","text-info"],["role","status",1,"spinner-border","spinner-border-sm"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"],[3,"innerHTML"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["class","spinner-border spinner-border-sm","role","status","aria-hidden","true",4,"ngIf"],["class","sr-only",4,"ngIf"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"sr-only"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"form",5),e.NdJ("ngSubmit",function(){return i.submitForm()}),e.TgZ(8,"div",6)(9,"div",7)(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",9)(15,"div",12)(16,"label"),e._uU(17),e.qZA(),e.TgZ(18,"span",13),e._uU(19,"*"),e.qZA()(),e.TgZ(20,"div",14)(21,"span",15),e._UZ(22,"i",16),e.qZA()()(),e.TgZ(23,"select",17),e.YNc(24,D,2,2,"option",18),e.qZA()()(),e.TgZ(25,"div",10)(26,"div",11)(27,"div",9)(28,"div",19)(29,"label",20),e._uU(30),e.qZA(),e.TgZ(31,"span",13),e._uU(32,"*"),e.qZA()(),e.TgZ(33,"div",21)(34,"span",15),e._UZ(35,"i",16),e.qZA()()(),e.TgZ(36,"div",9)(37,"div")(38,"input",22),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"dotNumber")})("keypress",function(a){return i.keyPressAlphaNumeric(a)}),e.qZA(),e.YNc(39,h,2,1,"span",23),e.YNc(40,M,2,1,"span",23),e.YNc(41,q,2,1,"span",23),e.YNc(42,J,2,1,"span",23),e.qZA(),e.YNc(43,R,3,2,"div",24),e.qZA()()()(),e.TgZ(44,"div",25)(45,"div",10)(46,"div",11)(47,"div",9)(48,"div",26)(49,"label",20),e._uU(50),e.qZA(),e.TgZ(51,"span",13),e._uU(52,"*"),e.qZA()(),e.TgZ(53,"div",26)(54,"span",15),e._UZ(55,"i",16),e.qZA()()(),e.TgZ(56,"input",27),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"name")}),e.qZA(),e.YNc(57,k,2,1,"span",23),e.YNc(58,B,2,1,"span",23),e.YNc(59,X,2,1,"span",23),e.qZA()(),e.TgZ(60,"div",10)(61,"div",11)(62,"div",9)(63,"div",12)(64,"label",28),e._uU(65),e.qZA(),e.TgZ(66,"span",13),e._uU(67,"*"),e.qZA()(),e.TgZ(68,"div",14)(69,"span",15),e._UZ(70,"i",16),e.qZA()()(),e.TgZ(71,"textarea",29),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"address")})("input",function(){return i.getRemainingText()}),e._uU(72," \n "),e.qZA(),e.TgZ(73,"span",30),e._uU(74),e.qZA(),e.YNc(75,de,2,1,"span",23),e.YNc(76,oe,2,1,"span",23),e.qZA()()(),e.TgZ(77,"div",25)(78,"div",10)(79,"div",11)(80,"div",9)(81,"div",26)(82,"label"),e._uU(83),e.qZA(),e.TgZ(84,"span",13),e._uU(85,"*"),e.qZA()(),e.TgZ(86,"div",26)(87,"span",15),e._UZ(88,"i",16),e.qZA()()(),e.TgZ(89,"select",31),e.YNc(90,me,2,2,"option",18),e.qZA()()(),e.TgZ(91,"div",10)(92,"div",11)(93,"div",9)(94,"div",26)(95,"label"),e._uU(96),e.qZA(),e.TgZ(97,"span",13),e._uU(98,"*"),e.qZA()(),e.TgZ(99,"div",26)(100,"span",15),e._UZ(101,"i",16),e.qZA()()(),e.TgZ(102,"select",32),e.YNc(103,ne,2,2,"option",18),e.qZA()()()(),e.TgZ(104,"div",25)(105,"div",33),e.YNc(106,ae,7,6,"div",34),e.qZA()(),e.TgZ(107,"div",25)(108,"div",35),e.YNc(109,Ae,4,2,"div",34),e.YNc(110,Te,5,1,"div",34),e.TgZ(111,"div",11)(112,"div",36),e._UZ(113,"input",37),e.TgZ(114,"label",38),e._uU(115),e.qZA()()(),e.YNc(116,Ce,5,1,"div",34),e.TgZ(117,"div",11)(118,"div",36),e._UZ(119,"input",39),e.TgZ(120,"label",40),e._uU(121),e.qZA()()(),e.TgZ(122,"div",11)(123,"div",36),e._UZ(124,"input",41),e.TgZ(125,"label",42),e._uU(126),e.qZA()()(),e.YNc(127,Ue,5,1,"div",34),e.YNc(128,Ne,5,1,"div",34),e.YNc(129,ue,5,1,"div",34),e.qZA()(),e.TgZ(130,"div",11)(131,"div",36),e._UZ(132,"input",43),e.TgZ(133,"label",44),e._uU(134),e.qZA()()(),e.YNc(135,Ke,9,3,"div",45),e.YNc(136,Xe,7,2,"div",46),e.qZA()()()()(),e.TgZ(137,"div",47),e.YNc(138,si,4,4,"button",48),e.TgZ(139,"button",49),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(140),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.carrier),e.xp6(5),e.Q6J("formGroup",i.c
1arrierForm),e.xp6(10),e.Oqu(i.locales.carriercountry),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.countries),e.xp6(6),e.Oqu(i.locales.dotnscNumber),e.xp6(5),e.hYB("ngbTooltip","",i.locales.required,". ",i.locales.numberChar,""),e.xp6(2),e.Tol((1===i.carrierPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId))&&1==+i.Country.value?"col-md-10":"col-12"),e.xp6(1),e.s9C("placeholder",i.locales.dotnscNumber),e.Q6J("ngClass",e.VKq(55,et,((null==i.DotNumber?null:i.DotNumber.errors)||""===(null==i.DotNumber?null:i.DotNumber.value))&&(i.DotNumber.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("dotNumber")||""===(null==i.DotNumber?null:i.DotNumber.value)),e.xp6(1),e.Q6J("ngIf",(null==i.DotNumber||null==i.DotNumber.errors?null:i.DotNumber.errors.checkDOTNumber)&&(i.DotNumber.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(null==i.DotNumber||null==i.DotNumber.errors?null:i.DotNumber.errors.max)&&(i.DotNumber.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(null==i.DotNumber||null==i.DotNumber.errors?null:i.DotNumber.errors.min)&&(i.DotNumber.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(1===i.carrierPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId))&&1==+i.Country.value),e.xp6(7),e.Oqu(i.locales.carrier_name),e.xp6(5),e.hYB("ngbTooltip","",i.locales.required,". ",i.locales.onlyAlfanumeric,""),e.xp6(1),e.s9C("placeholder",i.locales.carrier_name),e.Q6J("ngClass",e.VKq(57,et,(null==i.Name?null:i.Name.errors)&&(i.Name.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("name")),e.xp6(1),e.Q6J("ngIf",(null==i.Name||null==i.Name.errors?null:i.Name.errors.minlength)&&(i.Name.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(null==i.Name?null:i.Name.errors)&&(i.Name.touched||2===i.formType)),e.xp6(6),e.Oqu(i.locales.carrier_address),e.xp6(5),e.hYB("ngbTooltip","",i.locales.required,". ",i.locales.onlyAlfanumeric,""),e.xp6(1),e.s9C("placeholder",i.locales.carrier_address),e.Q6J("ngClass",e.VKq(59,et,(null==i.Address?null:i.Address.errors)&&(i.Address.touched||2===i.formType))),e.xp6(3),e.hij("",i.inputTextLength," / 150"),e.xp6(1),e.Q6J("ngIf",i.required("address")),e.xp6(1),e.Q6J("ngIf",(null==i.Address||null==i.Address.errors?null:i.Address.errors.checkNameAndAddress)&&(i.Address.touched||2===i.formType)),e.xp6(7),e.Oqu(i.locales.timezone),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.timeZones),e.xp6(6),e.Oqu(i.locales.units),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.fuelUnitCodes),e.xp6(3),e.Q6J("ngIf",1===i.carrierPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(3),e.Q6J("ngIf",i.pToken&&i.enableByRole),e.xp6(1),e.Q6J("ngIf",1===i.role&&1==i.DTCCodes.value||1!==i.role),e.xp6(5),e.Oqu(i.locales.active_driver),e.xp6(1),e.Q6J("ngIf",1===i.reseller.ShowAutomaticDriving),e.xp6(5),e.Oqu(i.locales.ecmLinkConnection),e.xp6(5),e.Oqu(i.locales.force_asset_selection),e.xp6(1),e.Q6J("ngIf",1===i.role&&1==i.CanadaEnabled.value||1!==i.role),e.xp6(1),e.Q6J("ngIf",1===i.role&&1==i.WorkorderEnabled.value||1!==i.role),e.xp6(1),e.Q6J("ngIf",1===i.role&&1==i.EnhancedIFTAEnabled.value||1!==i.role),e.xp6(5),e.Oqu(i.locales.enableaiVision),e.xp6(1),e.Q6J("ngIf",2===i.formType&&i.enableStatusChange()),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("ngIf",1===i.carrierPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.hij(" ",i.locales.close," "))},dependencies:[Q.mk,Q.sg,Q.O5,c._Y,c.YN,c.Kr,c.Fj,c.Wl,c.EJ,c.JJ,c.JL,c.Q7,c.wO,c.nD,c.sg,c.u,P._L],styles:[".form-group[_ngcontent-%COMP%]{margin-bottom:.3rem}.input-size[_ngcontent-%COMP%]{width:270px}"]})}return r})();function ri(r,l){if(1&r&&(e.TgZ(0,"span",21),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.requiredTitle)}}function oi(r,l){if(1&r&&(e.TgZ(0,"span",21),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.requiredMessage)}}function ni(r,l){if(1&r&&(e.TgZ(0,"div",22)(1,"button",23),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",24),e._uU(5),e.qZA(),e._uU(6),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.hij(" ",t.formState.message," ")}}const pt=function(r){return{"is-invalid":r}};let ft=(()=>
1{class r{constructor(t,s){this.activeModal=t,this.fb=s,this.onSendNoti=new e.vpe,this.onSubmit=new e.vpe}ngOnInit(){this.driverNotiForm=this.fb.group({title:["",[c.kI.required]],message:["",[c.kI.required]]})}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close()}required(t){return this.driverNotiForm.get(`${t}`).hasError("required")&&this.driverNotiForm.get(`${t}`).touched}onValueAdd(t,s){let i=t.trim();this.driverNotiForm.get(`${s}`).setValue(i)}submitForm(){let t=this.driverNotiForm.value,s="";this.driverNotiForm.invalid&&(s=this.locales.invalidForm),""!==s?this.formState={loading:!1,submited:!1,errors:!0,message:s}:this.onSubmit.emit({notification:t})}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(c.QS))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-driver-noti-form"]],inputs:{formState:"formState",locales:"locales"},outputs:{onSendNoti:"onSendNoti",onSubmit:"onSubmit"},decls:42,vars:21,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["id","driverNotiForm","role","form",3,"formGroup","ngSubmit"],["ngbAutofocus","",1,"card-body"],[1,"form-group"],["for","notiTitle"],[1,"row"],[1,"col-6"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["type","text","formControlName","title","required","",1,"form-control",3,"ngClass","placeholder","change"],["class","error invalid-feedback",4,"ngIf"],["type","text","formControlName","message","required","",1,"form-control",3,"ngClass","placeholder","change"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"modal-footer"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["type","button",1,"btn","btn-outline-dark",3,"click"],[1,"error","invalid-feedback"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"form",5),e.NdJ("ngSubmit",function(){return i.submitForm()}),e.TgZ(8,"div",6)(9,"div",7)(10,"label",8),e._uU(11),e.qZA()(),e.TgZ(12,"div",7)(13,"div",9)(14,"div",10)(15,"label"),e._uU(16),e.qZA(),e.TgZ(17,"span",11),e._uU(18,"*"),e.qZA()(),e.TgZ(19,"div",10)(20,"span",12),e._UZ(21,"i",13),e.qZA()()(),e.TgZ(22,"input",14),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"title")}),e.qZA(),e.YNc(23,ri,2,1,"span",15),e.qZA(),e.TgZ(24,"div",7)(25,"div",9)(26,"div",10)(27,"label"),e._uU(28),e.qZA(),e.TgZ(29,"span",11),e._uU(30,"*"),e.qZA()(),e.TgZ(31,"div",10)(32,"span",12),e._UZ(33,"i",13),e.qZA()()(),e.TgZ(34,"input",16),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"message")}),e.qZA(),e.YNc(35,oi,2,1,"span",15),e.qZA(),e.YNc(36,ni,7,2,"div",17),e.qZA()()(),e.TgZ(37,"div",18)(38,"button",19),e.NdJ("click",function(){return i.submitForm()}),e._uU(39),e.qZA(),e.TgZ(40,"button",20),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(41),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.notification),e.xp6(5),e.Q6J("formGroup",i.driverNotiForm),e.xp6(4),e.Oqu(i.locales.recomendedNotifications),e.xp6(5),e.Oqu(i.locales.title),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.s9C("placeholder",i.locales.notificationTitle),e.Q6J("ngClass",e.VKq(17,pt,i.required("title"))),e.xp6(1),e.Q6J("ngIf",i.required("title")),e.xp6(5),e.Oqu(i.locales.message),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.s9C("placeholder",i.locales.notificationMessage),e.Q6J("ngClass",e.VKq(19,pt,i.required("message"))),e.xp6(1),e.Q6J("ngIf",i.required("message")),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("disabled",i.driverNotiForm.invalid),e.xp6(1),e.Oqu(i.locales.send_notification),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.mk,Q.O5,P._L,c._Y,c.Fj,c.JJ,c.JL,c.Q7,c.sg,c.u]})}return r})();class gt{static checkPassword(l){const t=l.get("password"),s=l.get("
1confirmPassword");return t&&s&&t.value!==s.value?{checkpassword:!0}:null}static checkState(l){const t=l.get("state");return t&&(""===t.value||0===t.value.length||t.value.startsWith("--"))?{checkstate:!0}:null}}var Le=F(75198),we=F(4327),Ve=F(44758);function ai(r,l){if(1&r&&(e.TgZ(0,"option",9),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}let vt=(()=>{class r{constructor(){this.onJurisdictionChange=new e.vpe}ngAfterViewInit(){$("#jurisdiction").select2(),$("#jurisdiction").on("change",t=>{this.onJurisdictionChange.emit(t.target.value)})}ngOnDestroy(){$(".select2-container").removeClass("select2-container--open"),$("#jurisdiction").remove()}static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["jurisdiction-selector"]],inputs:{parent:"parent",locales:"locales",jurisdictions:"jurisdictions"},outputs:{onJurisdictionChange:"onJurisdictionChange"},decls:12,vars:4,consts:[[1,"form-group",3,"formGroup"],[1,"row"],[1,"col-6"],["for","jurisdiction"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["formControlName","jurisdiction","id","jurisdiction",1,"form-control",2,"width","100%"],[3,"value",4,"ngFor","ngForOf"],[3,"value"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"label",3),e._uU(4),e.qZA(),e.TgZ(5,"span",4),e._uU(6,"*"),e.qZA()(),e.TgZ(7,"div",2)(8,"span",5),e._UZ(9,"i",6),e.qZA()()(),e.TgZ(10,"select",7),e.YNc(11,ai,2,2,"option",8),e.qZA()()),2&s&&(e.Q6J("formGroup",i.parent),e.xp6(4),e.Oqu(i.locales.operatingZone),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.jurisdictions))},dependencies:[Q.sg,P._L,c.YN,c.Kr,c.EJ,c.JJ,c.JL,c.sg,c.u],changeDetection:0})}return r})();function li(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.onlyAlfanumeric," ")}}function ci(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij("",t.locales.required,".")}}function di(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.name_validation," ")}}function mi(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij("",t.locales.required,".")}}function ui(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.onlyAlfanumeric)}}function hi(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.last_name_validation," ")}}function pi(r,l){if(1&r&&(e.TgZ(0,"span",69),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.selectValidCarrier," ")}}function fi(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",10)(1,"carrier-selector",68),e.NdJ("onCarrierSelected",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onCarrierSelected(i))}),e.qZA(),e.YNc(2,pi,2,1,"span",47),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Q6J("carriers",t.moaCarriers)("selectedCarrier",t.selectedCarrierObj)("locales",t.locales)("selectorId","carrierSelectorDriver")("label",(null==t.locales?null:t.locales.carrier)||"Carrier")("showLabel",!0),e.xp6(1),e.Q6J("ngIf",t.errorCarrierSel)}}function gi(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function vi(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.invalidDriverUsername)}}function _i(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.username_validation)}}function Si(r,l){1&r&&(e.TgZ(0,"span",14),e._uU(1,"*"),e.qZA())}function bi(r,l){if(1&r&&e._UZ(0,"i",16),2&r){const t=e.oxw(2);e.hYB("ngbTooltip","",t.locales.notRequired," ",t.locales.maxPasswordCharacters,"")}}function Ci(r,l){if(1&r&&e._UZ(0,"i",16),2&r){const t=e.oxw(2);e.hYB("ngbTooltip","",t.locales.required,". ",t.locales.maxPasswordCharacters,"")}}function Ti(r,l){if(1&r&&(e.TgZ(0,"span",77),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij("",t.locales.enter_ValidSupportPassword," ")}}function yi(r,l){if(1&r&&(e.TgZ(0,"span",77),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij("",t.locales.required,". ")}}const Fe=function(r){return{"is-invalid":r}};function Ai(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",11)(1,"div",9)(2,"div",12)(3,"label"),e._uU(4),e.qZA(),e.YNc(5,Si,2,0,"span",70),e.qZA(),e.TgZ(6,"div",12)(7,"span",15),e.YNc(8,bi,1,2,"i",71),e.YNc(9,Ci,1,2,"i",71),e.qZA()()(),e.TgZ(10,"div",72),e._UZ(11,"input",73),e.TgZ(12,"button",74),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.hideShow())}),e._UZ(13,"i",75),e.qZA()(),e.YNc(14,Ti,2,1,"span",76),e.YNc(15,yi,2,1,"span",76),e.qZA()}if(2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.password),e.xp6(1),e.Q6J("ngIf",0===t.driver.HOSDriverId),e.xp6(3),e.Q6J("ngIf",0!==t.driver.HOSDriverId),e.xp6(1),e.Q6J("ngIf",0===t.driver.HOSDriverId),e.xp6(2),e.Q6J("type",t.hide?"password":"text")("ngClass",e.VKq(11,Fe,((null==t.SupportPassword?null:t.SupportPassword.errors)||t.requiredPassword())&&(t.SupportPassword.touched||2===t.formType))),e.xp6(2),e.Udp("margin-right",(null!=t.SupportPassword&&t.SupportPassword.errors||t.requiredPassword())&&(t.SupportPassword.touched||2===t.formType)?"15px":""),e.Q6J("ngClass",t.hide?"fas fa-eye-slash":"fas fa-eye"),e.xp6(1),e.Q6J("ngIf",(null==t.SupportPassword?null:t.SupportPassword.errors)&&(t.SupportPassword.touched||2===t.formType)),e.xp6(1),e.Q6J("ngIf",t.requiredPassword()&&(t.SupportPassword.touched||2===t.formType))}}function Ii(r,l){1&r&&(e.TgZ(0,"span",14),e._uU(1,"*"),e.qZA())}function xi(r,l){if(1&r&&(e.TgZ(0,"span",77),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.required)}}function Oi(r,l){if(1&r&&(e.TgZ(0,"span",77),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.password_confirmation_validation)}}function Ui(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",11)(1,"div",9)(2,"div",12)(3,"label"),e._uU(4),e.qZA(),e.YNc(5,Ii,2,0,"span",70),e.qZA(),e.TgZ(6,"div",12)(7,"span",15),e._UZ(8,"i",16),e.qZA()()(),e.TgZ(9,"div",72),e._UZ(10,"input",78),e.TgZ(11,"button",74),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.hideShow())}),e._UZ(12,"i",75),e.qZA()(),e.YNc(13,xi,2,1,"span",76),e.YNc(14,Oi,2,1,"span",76),e.qZA()}if(2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.confirmation),e.xp6(1),e.Q6J("ngIf",0===t.driver.HOSDriverId),e.xp6(3),e.s9C("ngbTooltip",t.locales.passwordsMatch),e.xp6(2),e.Q6J("type",t.hide?"password":"text")("ngClass",e.VKq(10,Fe,(t.ConfirmPassword.touched||2===t.formType)&&((null==t.driverForm.errors?null:t.driverForm.errors.checkpassword)||(null==t.ConfirmPassword?null:t.ConfirmPassword.errors)))),e.xp6(2),e.Udp("margin-right",(t.ConfirmPassword.touched||2===t.formType)&&(null!=t.driverForm.errors&&t.driverForm.errors.checkpassword||null!=t.ConfirmPassword&&t.ConfirmPassword.errors)?"15px":""),e.Q6J("ngClass",t.hide?"fas fa-eye-slash":"fas fa-eye"),e.xp6(1),e.Q6J("ngIf",(t.ConfirmPassword.touched||2===t.formType)&&(null==t.ConfirmPassword?null:t.ConfirmPassword.errors)),e.xp6(1),e.Q6J("ngIf",!t.samePasswords()&&(t.ConfirmPassword.touched||2===t.formType))}}function Zi(r,l){if(1&r&&(e.TgZ(0,"option",79),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.HOSHomeBaseId),e.xp6(1),e.Oqu(t.Name)}}function wi(r,l){if(1&r&&(e.TgZ(0,"option",79),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function Ni(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"jurisdiction-selector",80),e.NdJ("onJurisdictionChange",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.jurisdictionChange(i))}),e.qZA()}if(2&r){const t=e.oxw();e.Q6J("parent",t.driverForm)("locales",t.locales)("jurisdictions",t.jurisdictions)}}function Hi(r,l){if(1&r&&(e.TgZ(0,"option",79),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function Di(r,l){if(1&r&&(e.TgZ(0,"option",79),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function Fi(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",81)(1,"h5"),e._uU(2,"Warning!"),e.qZA(),e.TgZ(3,"div")(4,"p"),e._uU(5,"This change may impact the upcoming billing report and invoice."),e.qZA()(),e.TgZ(6,"div")(7,"button",82),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.proceedActiveChange())}),e._uU(8,"Proceed"),e.qZA(),e.TgZ(9,"button",83),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.cancelActiveChange())}),e._uU(10,"Close"),e.qZA()()()}}function Mi(r,l){if(1&r&&(e.TgZ(0,"option",79),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.value),e.xp6(1),e.hij(" ",t.label," ")}}function ki(r,l){if(1&r&&(e.TgZ(0,"span",69),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.selectValidExemption," ")}}function qi(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.customReasonRequired)}}function Li(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",10)(1,"div",9)(2,"div",12)(3,"label"),e._uU(4,"Custom Reason"),e.qZA(),e.TgZ(5,"span",14),e._uU(6,"*"),e.qZA()(),e.TgZ(7,"div",12)(8,"span",15),e._UZ(9,"
1i",16),e.qZA()()(),e.TgZ(10,"input",84),e.NdJ("change",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onValueAdd(i.target.value,"customReason"))}),e.qZA(),e.YNc(11,qi,2,1,"span",18),e.qZA()}if(2&r){const t=e.oxw();e.xp6(9),e.hYB("ngbTooltip","",t.locales.required,". ",t.locales.customReasonValidation,""),e.xp6(1),e.Q6J("ngClass",e.VKq(4,Fe,"Custom Reason"===(null==t.ExemptionReason?null:t.ExemptionReason.value)&&(""===(null==t.CustomReason?null:t.CustomReason.value)||!(null!=t.CustomReason&&t.CustomReason.value)))),e.xp6(1),e.Q6J("ngIf","Custom Reason"===(null==t.ExemptionReason?null:t.ExemptionReason.value)&&""===(null==t.CustomReason?null:t.CustomReason.value)||!(null!=t.CustomReason&&t.CustomReason.value))}}function Ji(r,l){if(1&r&&(e.TgZ(0,"option",79),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function Bi(r,l){if(1&r&&(e.TgZ(0,"option",85),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.selectState)}}function Ei(r,l){if(1&r&&(e.TgZ(0,"option",79),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.value),e.xp6(1),e.hij(" ",t.label," ")}}function Pi(r,l){if(1&r&&(e.TgZ(0,"optgroup",86),e.YNc(1,Ei,2,2,"option",29),e.qZA()),2&r){const t=l.$implicit;e.s9C("label",t.name),e.xp6(1),e.Q6J("ngForOf",t.states)}}function Ri(r,l){if(1&r&&(e.TgZ(0,"span",69),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.state_validation," ")}}function Yi(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.license_number_validation,"")}}function $i(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.license_number_validation,"")}}function Qi(r,l){if(1&r&&(e.TgZ(0,"span",67),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.check_alfaNumeric,"")}}function Vi(r,l){if(1&r&&(e.TgZ(0,"div",87)(1,"button",88),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",89),e._uU(5),e.qZA(),e._UZ(6,"div",90),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.Q6J("innerHTML",t.formState.message,e.oJD)}}function Wi(r,l){1&r&&e._UZ(0,"span",94)}function zi(r,l){if(1&r&&(e.TgZ(0,"span",95),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.loading)}}function ji(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",91),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.submitForm())}),e.YNc(1,Wi,1,0,"span",92),e.YNc(2,zi,2,1,"span",93),e._uU(3),e.qZA()}if(2&r){const t=e.oxw();
1e.Q6J("disabled",t.driverForm.invalid||t.DisabledActivatedDriver||t.formState.loading||!t.driverForm.dirty||t.requiredPassword()||0==+t.driverForm.get("homebase").value||!t.requiredCarrier()&&(null==t.moaForUser?null:t.moaForUser.length)>0||t.showActiveWarning),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.hij(" ",t.locales.save," ")}}const Gi=function(r){return{"invalid-color":r}};let it=(()=>{class r{constructor(t,s,i,o,a,d,m,v,Z){this.activeModal=t,this.fb=s,this.driverService=i,this.confirmDialogService=o,this.utilService=a,this.homeBaseService=d,this.hosService=m,this.authService=v,this.carrierService=Z,this.onUnLockDriver=new e.vpe,this.onSubmit=new e.vpe,this.onHombeBasesList=new e.vpe,this.FuelUnitCodes=[],this.jurisdictions=[],this.canadaJurisdictions=!1,this.driverPasswd="",this.driverConfirmPasswd="",this.IsActive=!1,this.Wifi=!1,this.PersonalUse=!1,this.YardMove=!1,this.Exemption=!1,this.selectChanged=!1,this.requiredHomeBase=!1,this.errorSelect=!1,this.errorExemption=!1,this.moaCarriers=[],this.errorCarrierSel=!1,this.selectedCarrierObj=null,this.showActiveWarning=!1,this.originalActiveValue=!1,this.piriodTime=[{key:0,label:"Midnight"}],this.jurisdictionList=[{key:2,label:"North"},{key:1,label:"South"},{key:3,label:"USA"}],this.driverValidator={driverNameError:!1,status:"invalid"},this.dvirAccessList=[],this.hide=!0,this.exemptionList=[],this.driverModalSub=new V.w}ngOnInit(){this.loginUser=this.hosService.loginUser,this.FuelUnitCodes=this.utilService.fuelUnitCodes,this.partnerId=this.authService.appCredentials.partnerId,this.moaForUser=this.hosService.moaForUser,this.exemptionList=29===this.driver.HOSRuleSetId||30===this.driver.HOSRuleSetId?this.driverService.exemptionList.filter(s=>s.code>=12&&s.code<=16||1===s.code):this.isCanadaRuleset(this.driver.HOSRuleSetId)?this.driverService.exemptionList.filter(s=>(s.code<11||1===s.code)&&!(s.code>=12&&s.code<=16)):this.driverService.exemptionList.filter(s=>(s.code<10||11===s.code||1===s.code)&&!(s.code>=12&&s.code<=16)),2!==this.carrier.CarrierCountry&&5!==this.partnerId&&(this.piriodTime=[...this.piriodTime,{key:1,label:"Current Time"}]),this.IsActive=!!this.driver.IsActive,this.Wifi=!!this.driver.Wifi,this.PersonalUse=!!this.driver.PersonalUse,this.YardMove=!!this.driver.YardMove,this.Exemption=!!this.driver.Exemption,this.jurisdictions=this.jurisdictionList.filter(5===this.driver.HOSRuleSetId||6===this.driver.HOSRuleSetId||19===this.driver.HOSRuleSetId||29===this.driver.HOSRuleSetId||30===this.driver.HOSRuleSetId?s=>3!==s.key:s=>3===s.key),this.canadaJurisdictions=5===this.driver.HOSRuleSetId||6===this.driver.HOSRuleSetId||19===this.driver.HOSRuleSetId,this.driverForm=this.fb.group({name:[this.driver.Name,[c.kI.required,c.kI.minLength(2),c.kI.maxLength(30)]],lastName:[this.driver.LastName,[c.kI.required,c.kI.minLength(2),c.kI.maxLength(30)]],carrier:[this.driver.HOSClientId],userName:[this.driver.HOSUserName,[c.kI.required,c.kI.minLength(4),c.kI.maxLength(50),u.s.checkUsername]],password:["",c.kI.maxLength(15)],confirmPassword:["",c.kI.maxLength(15)],homebase:[this.driver.HOSHomeBaseId],ruleset:[this.driver.HOSRuleSetId],jurisdiction:[this.driver.JurisdictionCode],startingTime:[this.driver.Starting24HTime],dvirAccess:[this.driver.DVIRAccess],active:[{value:!this.DisabledActivatedDriver&&0===this.driver.HOSDriverId||!!this.driver.IsActive,disabled:this.DisabledActivatedDriver||0===this.driver.HOSDriverId||this.disabledActivateDriver}],personalUse:[this.driver.PersonalUse],yardMove:[this.driver.YardMove],exemption:[this.driver.Exemption],fuelUnitCode:0===this.driver.HOSDriverId?[this.carrier.FuelUnitCode]:[this.driver.FuelUnitCode],state:[this.driver.LicenseState],licenseNumber:[this.driver.LicenseNumber.trim(),[c.kI.required,c.kI.minLength(2),c.kI.maxLength(20),u.s.checkLicenseNumber]],dvirWifi:[this.driver.Wifi],alllowExemption:[this.driver.AllowDriverExemptionSelection],takeDVIRPhotoEnabled:[this.driver.TakeDVIRPhotoEnabled],exemptionReason:[this.driver.ExemptionReason],customReason:[]},{validators:[gt.checkPassword,gt.checkState]}),""===this.driver.LicenseState&&this.State.setValue(this.locales.selectState),this.getHomeBases(),6===this.driverPermission&&this.loginUser&&6!==this.loginUser.HOSUserTypeId&&7!==this.loginUser.HOSUserTypeId&&this.driverForm.disable(),this.translateDVIRAccess();const{CountMode:t=0}=this.authService?.appReseller||{};if(this.originalActiveValue=this.driverForm.get("active").value,this.driverForm.get("active").valueChanges.subscribe(s=>{const i=localStorage.getItem("statusChangeConfirmed")||"no";this.showActiveWarning=!(this.originalActiveValue===s||1!==t&&2!==t||!i||"yes"===i)}),2===this.formType&&""===this.driver.LicenseState&&(this.errorSelect=!0,$("#state").select2({containerCssClass:"invalid-color"})),9===this.loginUser?.HOSUserTypeId||this.moaForUser?.length>0){this.moaCarriers=this.hosService.moaForUser[0].HOSClients,10===this.loginUser?.HOSUserTypeId&&this.loginUser?.HOSClients?.length>0&&(this.moaCarriers=this.hosService.carriers);let s=this.carrierService.getPristineCarrier();s.Name=` -- ${this.locales.select_carrier} -- `;const i=this.moaCarriers.find(o=>-1===o.HOSClientId);if(1===this.formType){this.FuelUnitCode.setValue(1),void 0===i&&this.moaCarriers.unshift(s);const o=this.carrier?.HOSClientId>0?this.moaCarriers.find(a=>a.HOSClientId===this.carrier.HOSClientId):null;o?(this.Carrier.setValue(o.HOSClientId),this.selectedCarrierObj=o):(this.Carrier.setValue(-1),this.selectedCarrierObj=s)}else i&&this.moaCarriers.shift(),this.selectedCarrierObj=this.moaCarriers.find(o=>o.HOSClientId===this.driver.HOSClientId)||null}this.driverForm.get("exemption").value?$("#exemptionContainer").show():$("#exemptionContainer").hide(),2===this.formType&&this.driver.Exemption>0&&void 0===this.exemptionList.find(i=>i.value===this.driver.ExemptionReason)&&(this.ExemptionReason.setValue(this.exemptionList[this.exemptionList.length-1].value),this.CustomReason.setValue(this.driver.ExemptionReason))}translateDVIRAccess(){this.dvirAccessList=[{key:1,label:this.locales.dvir},{key:2,label:this.locales.noDVIR},{key:3,label:this.locales.dvirOnly}]}ngOnDestroy(){$(".select2-container").removeClass("select2-container--open"),this.homebasesList.find(i=>0===i.HOSHomeBaseId)&&this.homebasesList.shift(),$("#homebase").remove(),$("#ruleset").remove(),$("#startingTime").remove(),$("#fuelUnitCode").remove(),$("#state").remove(),$("#dvirAccess").remove(),$("#exemptionReason").remove(),this.driverModalSub.unsubscribe()}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close(),this.driverForm.get("exemption")?.value||this.ExemptionReason.setErrors(null),"Custom Reason"!==this.ExemptionReason?.value&&this.CustomReason.setErrors(null)}ngAfterViewInit(){$("#homebase").select2(),$("#ruleset").select2(),$("#startingTime").select2(),$("#fuelUnitCode").select2(),$("#exemptionReason").select2(),$("#dvirAccess").select2(),(1===this.formType||""!==this.driver.LicenseState)&&$("#state").select2(),$("#homebase").on("change",t=>{this.driverForm.get("homebase").setValue(t.target.value),this.driverForm.markAsDirty()}),$("#ruleset").on("change",t=>{this.driverForm.get("ruleset").setValue(t.target.value),this.exemptionList=29==+t.target.value||30==+t.target.value?this.driverService.exemptionList.filter(i=>i.code>
1=12&&i.code<=16||1===i.code):this.isCanadaRuleset(+t.target.value)?this.driverService.exemptionList.filter(i=>(i.code<11||1===i.code)&&!(i.code>=12&&i.code<=16)):this.driverService.exemptionList.filter(i=>(i.code<10||11===i.code||1===i.code)&&!(i.code>=12&&i.code<=16)),void 0===this.exemptionList.find(i=>i.value===this.ExemptionReason.value)&&(this.ExemptionReason.setValue(""),this.CustomReason.setValue(""),$("#exemptionReason").val("").trigger("change")),5==+t.target.value||6==+t.target.value||19==+t.target.value||29==+t.target.value||30==+t.target.value?(this.jurisdictions=this.jurisdictionList.filter(i=>3!==i.key),this.driverForm.get("jurisdiction").setValue(1)):(this.jurisdictions=this.jurisdictionList.filter(i=>3===i.key),this.driverForm.get("jurisdiction").setValue(3)),this.driverForm.markAsDirty()}),$("#startingTime").on("change",t=>{this.driverForm.get("startingTime").setValue(t.target.value),this.driverForm.markAsDirty()}),$("#fuelUnitCode").on("change",t=>{this.driverForm.get("fuelUnitCode").setValue(t.target.value),this.driverForm.markAsDirty()}),$("#state").on("change",t=>{this.driverForm.markAsDirty(),this.driverForm.get("state").setValue(t.target.value),t.target.value===this.locales.selectState?(this.errorSelect=!0,setTimeout(()=>{$("#state").select2({containerCssClass:"invalid-color"})},50)):(this.errorSelect=!1,setTimeout(()=>{$("#state").select2()},50))}),$("#dvirAccess").on("change",t=>{this.driverForm.get("dvirAccess").setValue(t.target.value),this.driverForm.markAsDirty()}),$("#exemptionReason").on("change",t=>{this.driverForm.markAsDirty(),this.driverForm.get("exemptionReason").setValue(t.target.value),"Custom Reason"!==t.target.value&&this.CustomReason.setValue(""),""===t.target.value?(this.errorExemption=!0,setTimeout(()=>{$("#exemptionReason").select2({containerCssClass:"invalid-color"})},50)):(this.errorExemption=!1,setTimeout(()=>{$("#exemptionReason").select2()},50))})}requiredPassword(){return 0===this.driver.HOSDriverId&&""===this.SupportPassword.value}isUserNameReadOnly(){return this.driver.HOSUserName.length>0}getHomeBases(){if(this.homebasesList&&0!==this.homebasesList.length)if(this.requiredHomeBase=!0,0!==this.driver.HOSHomeBaseId)this.HomeBase.setValue(this.driver.HOSHomeBaseId);else{let t=this.homebasesList.find(s=>
11===s.DefaultHome);this.mainOfficeId=t?t.HOSHomeBaseId:this.homebasesList[0].HOSHomeBaseId,this.HomeBase.setValue(this.mainOfficeId)}else this.driverModalSub.add(this.homeBaseService.getHomeBases(this.carrier.HOSClientId,this.moaForUser?this.moaForUser[0]?.HOSAccountId:null).subscribe(t=>{if(this.homebasesList=[],this.onHombeBasesList.emit(t),this.homebasesList=t,0===this.homebasesList.length)this.homebasesList.unshift({HOSHomeBaseId:0,Name:this.locales.noHomeBase}),this.HomeBase.setValue(0),this.requiredHomeBase=!1,this.formState={loading:!1,submited:!1,errors:!0,message:this.hosService.moaForUser?.length>0?this.locales.noHomebaseCreatedMOA:this.locales.noHomebaseCreated};else if(this.requiredHomeBase=!0,0!==this.driver.HOSHomeBaseId)this.HomeBase.setValue(this.driver.HOSHomeBaseId);else{let s=this.homebasesList.find(i=>1===i.DefaultHome);this.mainOfficeId=s?s.HOSHomeBaseId:this.homebasesList[0].HOSHomeBaseId,this.HomeBase.setValue(this.mainOfficeId)}}))}jurisdictionChange(t){this.driverForm.markAsDirty(),this.driverForm.get("jurisdiction").setValue(t)}onCarrierSelected(t){this.selectedCarrierObj=t,this.driverForm.get("carrier").setValue(t?t.HOSClientId:-1),this.driverForm.markAsDirty(),this.errorCarrierSel=!t||-1===t.HOSClientId}get Name(){return this.driverForm.get("name")}get LastName(){return this.driverForm.get("lastName")}get ExemptionReason(){return this.driverForm.get("exemptionReason")}get UserName(){return this.driverForm.get("userName")}get LicenseNumber(){return this.driverForm.get("licenseNumber")}get State(){return this.driverForm.get("state")}get SupportPassword(){return this.driverForm.get("password")}get ConfirmPassword(){return this.driverForm.get("confirmPassword")}get HomeBase(){return this.driverForm.get("homebase")}get RuleSet(){return this.driverForm.get("ruleset")}get DVIRAccess(){return this.driverForm.get("dvirAccess")}get Carrier(){return this.driverForm.get("carrier")}get FuelUnitCode(){return this.driverForm.get("fuelUnitCode")}get CustomReason(){return this.driverForm.get("customReason")}get DisabledActivatedDriver(){return(!this.loginUser?.isSynthetic||1===this.role)&&!this.disabledByRole&&!this.IsActive&&!this.carrier.ActivateDriver&&this.loginUser&&9!==this.loginUser.HOSUserTypeId&&10!==this.loginUser.HOSUserTypeId}get disabledByRole(){return 2===this.role||3===this.role||4===this.role}required(t){return this.driverForm.get(`${t}`).hasError("required")&&(this.driverForm.get(`${t}`).touched||2===this.formType)}samePasswords(){return this.SupportPassword.value===this.ConfirmPassword.value}unlockDriver(){this.onUnLockDriver.emit(this.driver.HOSDriverId)}onValueAdd(t,s){let i=t.trim();this.driverForm.get(`${s}`).setValue(i)}findStartingTime(t){return this.piriodTime.find(s=>s.key===t)}findJurisdiction(t){return this.jurisdictions.find(s=>s.key===t)}findHomeBase(t){return this.homebasesList.find(s=>
1s.HOSHomeBaseId===t)}requiredCarrier(){return+this.Carrier.value>0}submitForm(){let t=this.driverForm.value,s=this.driverService.getPristineDriver(),i="";if(this.driverForm.invalid&&(i=this.locales.invalidForm+"<br/>"),this.findStartingTime(+t.startingTime)||(i+=this.locales.invalidPeriod+"<br/>"),this.utilService.findFuelUnitCode(+t.fuelUnitCode)||(i+=this.locales.invalidUnits+"<br/>"),this.utilService.findState(t.state)||(i+=this.locales.invalidState+"<br/>"),this.findHomeBase(+t.homebase)||(i+=this.locales.invalidHomeBase+"<br/>"),1===this.role&&!this.carrier.ActivateDriver&&!this.driver.IsActive&&this.loginUser&&9!==this.loginUser.HOSUserTypeId&&10!==this.loginUser.HOSUserTypeId&&(i+=this.locales.invalidActivate+"<br/>"),0==+t.homebase&&(i+=this.locales.homeBaseRequired+"<br/>"),this.checkValidDVIRAccess()||(i+=this.locales.invalidDVIRAccess+"<br/>"),!this.requiredCarrier()&&this.moaForUser?.length>0&&(i+=this.locales.selectValidCarrier+"<br/>"),""!==i)this.formState={loading:!1,submited:!1,errors:!0,message:i};else{if(s.index=this.driver.index,s.Name=t.name,s.LastName=t.lastName,s.HOSUserName=this.isUserNameReadOnly()?this.driver.HOSUserName:t.userName,s.IsActive=this.DisabledActivatedDriver||0!==this.driver.HOSDriverId?void 0!==t.active?+t.active:this.driver.IsActive:1,s.YardMove=+t.yardMove,+t.exemption>0){const o=this.driverService.exemptionList.find(a=>a.value===this.ExemptionReason?.value);s.Exemption=o?o.code:1}else s.Exemption=0;s.ExemptionReason=0==+t.exemption?"":""!==this.CustomReason?.value&&null!==this.CustomReason?.value?this.CustomReason?.value:t.exemptionReason&&t.exemptionReason?.length>0?t.exemptionReason:"",s.AllowDriverExemptionSelection=+t.alllowExemption,s.HOSRuleSetId=parseInt(t.ruleset),s.JurisdictionCode=29==t.ruleset||30==t.ruleset||20==t.ruleset?1:+t.jurisdiction,s.Wifi=+t.dvirWifi,s.PersonalUse=+t.personalUse,s.LicenseState=t.state,s.LicenseNumber=t.licenseNumber.toUpperCase(),s.Starting24HTime=+t.startingTime,s.ExternalName=this.driver.ExternalName,s.HOSDriverId=this.driver.HOSDriverId,s.ExternalDriverId=5===this.partnerId?0:this.driver.ExternalDriverId,s.ELDOperatingMode=this.driver.ELDOperatingMode,s.RuleSetTimestamp=this.driver.RuleSetTimestamp,s.HOSHomeBaseId=+t.homebase,s.TimeZoneCode=this.driver.TimeZoneCode,s.FuelUnitCode=+t.fuelUnitCode,s.DistanceUnitCode=+t.fuelUnitCode,s.TakeDVIRPhotoEnabled=+t.takeDVIRPhotoEnabled,s.DVIRAccess=+t.dvirAccess,this.loginUser&&9===this.loginUser.HOSUserTypeId||this.hosService.moaForUser?.length>0?(s.HOSAccountId=this.hosService.moaForUser[0].HOSAccountId,s.HOSClientId=-1==+t.carrier?0:+t.carrier):(s.HOSAccountId=0,s.HOSClientId=this.driver.HOSClientId),5===parseInt(t.ruleset)||6===parseInt(t.ruleset)?this.confirmDialogService.confirm(this.locales.pleaseConfirm,this.locales.canadarulset).then(o=>{o&&this.onSubmit.emit({driver:s,passwd:t.password})}).catch(()=>console.log()):this.onSubmit.emit({driver:s,passwd:t.password})}}ruleSetFilter(t){return t.filter(s=>5!==s.key&&6!==s.key)}checkPasswd(){return this.driverPasswd===this.driverConfirmPasswd}validateHosDriverId(){return!0}checkDriverName(){return this.driver.Name.length>2&&this.driver.Name.length<30}checkUserName(){return this.driver.HOSUserName.length>4&&this.driver.HOSUserName.length<60}checkActiveDriver(){return this.driver.IsActive=+this.IsActive,!(this.driver.HOSDriverId>0)&&1!==this.driver.IsActive}checkValidState(){return this.State.value===this.locales.selectState}checkValidDVIRAccess(){return+this.DVIRAccess.value>0&&+this.DVIRAccess.value<=3}isCanadaRuleset(t){return 5===t||6===t||19===t||20===t}noWhiteSpace(t){return!(this.LicenseNumber.value&&!/^[0-9a-zA-Z]+$/.test(t.key)&&(t.preventDefault(),1))}onlyAlphaNumeric(t){return!!t.match(/^[0-9a-zA-Z]+$/)}hideShow(){this.hide=!this.hide}exemptionChange(){this.ExemptionReason.setValue(""),$("#exemptionReason").val("").trigger("change"),this.driverForm.get("exemption").value?$("#exemptionContainer").show():$("#exemptionContainer").hide()}showJurisdiction(){return 5==+this.RuleSet?.value||6==+this.RuleSet?.value||19==+this.RuleSet?.value}proceedActiveChange(){localStorage.setItem("statusChangeConfirmed","yes"),this.showActiveWarning=!1,this.originalActiveValue=this.driverForm.get("active").value,this.IsActive=this.originalActiveValue}cancelActiveChange(){localStorage.setItem("statusChangeConfirmed","yes"),this.driverForm.get("active").setValue(this.originalActiveValue),this.showActiveWarning=!1,this.IsActive=this.originalActiveValue}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(c.QS),e.Y36(Le.F),e.Y36(S.O),e.Y36(b.f),e.Y36(we.s),e.Y36(y.T),e.Y36(p.e),e.Y36(I.V))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-driver-form"]],inputs:{driver:"driver",carrier:"carrier",driverPermission:"driverPermission",ruleSetList:"ruleSetList",licenseState:"licenseState",locales:"locales",role:"role",formState:"formState",homebasesList:"homebasesList",formType:"formType",disabledActivateDriver:"disabledActivateDriver"},outputs:{onUnLockDriver:"onUnLockDriver",onSubmit:"onSubmit",onHombeBasesList:"onHombeBasesList"},decls:231,vars:91,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["id","driverForm","role","form","novalidate","",3,"formGroup","ngSubmit"],["ngbAutofocus","",1,"card-body"],[1,"card","border-dark","mb-3",2,"width","100%"],[1,"card-body","text-dark","my_card-body"],[1,"row"],[1,"col-sm-6"],[1,"form-group"],[1,"col-6"],["for","driverName"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["type","text","formControlName","name","maxlength","30","required","",1,"form-control",3,"ngClass","placeholder","change"],["class","error invalid-feedback",4,"ngIf"],["for","lastName"],["type","text","formControlName","lastName","maxlength","30","required","",1,"form-control",3,"ngClass","placeholder","change"],["id","username","type","text","name","fakeusernameremembered",2,"display","none"],["id","password","type","password","name","fakepasswordremembered",2,"display","none"],[1,"row","top-buffer"],["class","col-sm-6",4,"ngIf"],["type","text","formControlName","userName","autocomplete","nope","id","real-username","maxlength","50","required","",1,"form-control",3,"ngClass","readonly","placeholder","keydown","change"],["class","form-group",4,"ngIf"],["for","homebase"],["formControlName","homebase","id","homebase",1,"form-control",2,"width","100%"],[3,"value",4,"ngFor","ngForOf"],["for","ruleset"],["formControlName","ruleset","id","ruleset",1,"form-control","select2",2,"width","100%"],[3,"parent","locales","jurisdictions","onJurisdictionChange",4,"ngIf"],[1,"col-10"],[1,"col-2"],["formControlName","startingTime","id","startingTime",1,"form-control","select2",2,"width","100%"],["formControlName","dvirAccess","id","dvirAccess",1,"form-control","select2",2,"width","100%"],["class","alert alert-secondary alert-dismissible",4,"ngIf"],[1,"form-check"],["type","checkbox","formControlName","active",1,"form-check-input"],["for","autodrive",1,"form-check-label"],["type","checkbox","formControlName","personalUse",1,"form-check-input"],["type","checkbox","formControlName","yardMove",1,"form-check-input"],["type","checkbox","formControlName","exemption",1,"form-check-input",3,"change"],["id","exemptionContainer",1,"row","top-buffer"],["id","exemptionReason","formControlName","exemptionReason","required","",1,"form-control","select2",2,"width","100%"],["value",""],["class","invali
1d-select",4,"ngIf"],["formControlName","fuelUnitCode","id","fuelUnitCode","required","",1,"form-control","select2",2,"width","100%"],[1,"col-8"],[1,"col-4"],["formControlName","state","id","state","required","",1,"form-control","select2",2,"width","100%",3,"ngClass"],["selected","true",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[1,"col-7"],["for","licenseNumber"],[1,"col-5"],["type","text","formControlName","licenseNumber","minlength","2","maxlength","20","oninput","this.value = this.value.toUpperCase()","required","",1,"form-control",3,"ngClass","placeholder","keydown"],["type","checkbox","formControlName","dvirWifi",1,"form-check-input"],["type","checkbox","formControlName","alllowExemption",1,"form-check-input"],["for","alllowExemption",1,"form-check-label"],["type","checkbox","formControlName","takeDVIRPhotoEnabled",1,"form-check-input"],["for","takeDVIRPhotoEnabled",1,"form-check-label"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"modal-footer"],["type","button","class","btn btn-primary",3,"disabled","click",4,"ngIf"],["type","button",1,"btn","btn-outline-dark",3,"click"],[1,"error","invalid-feedback"],[3,"carriers","selectedCarrier","locales","selectorId","label","showLabel","onCarrierSelected"],[1,"invalid-select"],["class","required-asterisk",4,"ngIf"],["class","far fa-question-circle","placement","left","tooltipClass","tooltip-color",3,"ngbTooltip",4,"ngIf"],[1,"custom"],["formControlName","password","autocomplete","new-password","id","real-password","placeholder","****","maxlength","15",1,"form-control","custom-input",3,"type","ngClass"],["type","button",1,"btn","custom-button",3,"click"],[3,"ngClass"],["class","invalid-input",4,"ngIf"],[1,"invalid-input"],["formControlName","confirmPassword","placeholder","****","maxlength","15",1,"form-control","custom-input",3,"type","ngClass"],[3,"value"],[3,"parent","locales","jurisdictions","onJurisdictionChange"],[1,"alert","alert-secondary","alert-dismissible"],[1,"btn","btn-outline-light","mr-2",3,"click"],["type","button",1,"btn","btn-outline-light",3,"click"],["type","text","placeholder","Custom Reason","formControlName","customReason","maxlength","60","required","",1,"form-control",3,"ngClass","change"],["selected","true"],[3,"label"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"],[3,"innerHTML"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["class","spinner-border spinner-border-sm","role","status","aria-hidden","true",4,"ngIf"],["class","sr-only",4,"ngIf"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"sr-only"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"form",5),e.NdJ("ngSubmit",function(){return i.submitForm()}),e.TgZ(8,"div",6)(9,"div",7)(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",9)(15,"div",12)(16,"label",13),e._uU(17),e.qZA(),e.TgZ(18,"span",14),e._uU(19,"*"),e.qZA()(),e.TgZ(20,"div",12)(21,"span",15),e._UZ(22,"i",16),e.qZA()()(),e.TgZ(23,"input",17),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"name")}),e.qZA(),e.YNc(24,li,2,1,"span",18),e.YNc(25,ci,2,1,"span",18),e.YNc(26,di,2,1,"span",18),e.qZA()(),e.TgZ(27,"div",10)(28,"div",11)(29,"div",9)(30,"div",12)(31,"label",19),e._uU(32),e.qZA(),e.TgZ(33,"span",14),e._uU(34,"*"),e.qZA()(),e.TgZ(35,"div",12)(36,"span",15),e._UZ(37,"i",16),e.qZA()()(),e.TgZ(38,"input",20),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"lastName")}),e.qZA(),e.YNc(39,mi,2,1,"span",18),e.YNc(40,ui,2,1,"span",18),e.YNc(41,hi,2,1,"span",18),e.qZA()()(),e._UZ(42,"input",21)(43,"input",22),e.TgZ(44,"div",23),e.YNc(45,fi,3,7,"div",24),e.TgZ(46,"div",10)(47,"div",11)(48,"div",9)(49,"div",12)(50,"label"),e._uU(51),e.qZA(),e.TgZ(52,"span",14),e._uU(53,"*"),e.qZA()(),e.TgZ(54,"div",12)(55,"span",15),e._UZ(56,"i",16),e.qZA()()(),e.TgZ(57,"input",25),e.NdJ("keydown",function(a){return i.noWhiteSpace(a)})("change",function(a){return i.onValueAdd(a.target.value,"userName")}),e.qZA(),e.YNc(58,gi,2,1,"span",18),e.YNc(59,vi,2,1,"span",18),e.YNc(60,_i,2,1,"span",18),e.qZA()()(),e.TgZ(61,"div",23)(62,"div",10),e.YNc(63,Ai,16,13,"div",26),e.qZA(),e.TgZ(64,"div",10),e.YNc(65,Ui,15,12,"div",26),e.qZA()(),e.TgZ(66,"div",23)(67,"div",10)(68,"div",11)(69,"div",9)(70,"div",12)(71,"label",27),e._uU(72),e.qZA(),e.TgZ(73,"span",14),e._uU(74,"*"),e.qZA()(),e.TgZ(75,"div",12)(76,"span",15),e._UZ(77,"i",16),e.qZA()()(),e.TgZ(78,"select",28),e.YNc(79,Zi,2,2,"option",29),e.qZA()()(),e.TgZ(80,"div",10)(81,"div",11)(82,"div",9)(83,"div",12)(84,"label",30),e._uU(85),e.qZA(),e.TgZ(86,"span",14),e._uU(87,"*"),e.qZA()(),e.TgZ(88,"div",12)(89,"
1span",15),e._UZ(90,"i",16),e.qZA()()(),e.TgZ(91,"select",31),e.YNc(92,wi,2,2,"option",29),e.qZA()()()(),e.TgZ(93,"div",23)(94,"div",10),e.YNc(95,Ni,1,3,"jurisdiction-selector",32),e.qZA()(),e.TgZ(96,"div",23)(97,"div",10)(98,"div",11)(99,"div",9)(100,"div",33)(101,"label"),e._uU(102),e.qZA(),e.TgZ(103,"span",14),e._uU(104,"*"),e.qZA()(),e.TgZ(105,"div",34)(106,"span",15),e._UZ(107,"i",16),e.qZA()()(),e.TgZ(108,"select",35),e.YNc(109,Hi,2,2,"option",29),e.qZA()()(),e.TgZ(110,"div",10)(111,"div",11)(112,"div",9)(113,"div",12)(114,"label",30),e._uU(115),e.qZA(),e.TgZ(116,"span",14),e._uU(117,"*"),e.qZA()(),e.TgZ(118,"div",12)(119,"span",15),e._UZ(120,"i",16),e.qZA()()(),e.TgZ(121,"select",36),e.YNc(122,Di,2,2,"option",29),e.qZA()()()(),e.YNc(123,Fi,11,0,"div",37),e.TgZ(124,"div",23)(125,"div",10)(126,"div",11)(127,"div",38),e._UZ(128,"input",39),e.TgZ(129,"label",40),e._uU(130),e.qZA()()(),e.TgZ(131,"div",11)(132,"div",38),e._UZ(133,"input",41),e.TgZ(134,"label",40),e._uU(135),e.qZA()()(),e.TgZ(136,"div",11)(137,"div",38),e._UZ(138,"input",42),e.TgZ(139,"label",40),e._uU(140),e.qZA()()(),e.TgZ(141,"div",11)(142,"div",38)(143,"input",43),e.NdJ("change",function(){return i.exemptionChange()}),e.qZA(),e.TgZ(144,"label",40),e._uU(145),e.qZA()()()()(),e.TgZ(146,"div",44)(147,"div",10)(148,"div",11)(149,"div",9)(150,"div",12)(151,"label"),e._uU(152),e.qZA(),e.TgZ(153,"span",14),e._uU(154,"*"),e.qZA()(),e.TgZ(155,"div",12)(156,"span",15),e._UZ(157,"i",16),e.qZA()()(),e.TgZ(158,"select",45)(159,"option",46),e._uU(160),e.qZA(),e.YNc(161,Mi,2,2,"option",29),e.qZA(),e.YNc(162,ki,2,1,"span",47),e.qZA()(),e.YNc(163,Li,12,6,"div",24),e.qZA(),e.TgZ(164,"div",23)(165,"div",10)(166,"div",11)(167,"div",9)(168,"div",12)(169,"label"),e._uU(170),e.qZA(),e.TgZ(171,"span",14),e._uU(172,"*"),e.qZA()(),e.TgZ(173,"div",12)(174,"span",15),e._UZ(175,"i",16),e.qZA()()(),e.TgZ(176,"select",48),e.YNc(177,Ji,2,2,"option",29),e.qZA()()(),e.TgZ(178,"div",10)(179,"div",11)(180,"div",9)(181,"div",49)(182,"label"),e._uU(183),e.qZA(),e.TgZ(184,"span",14),e._uU(185,"*"),e.qZA()(),e.TgZ(186,"div",50)(187,"span",15),e._UZ(188,"i",16),e.qZA()()(),e.TgZ(189,"select",51),e.YNc(190,Bi,2,1,"option",52),e.YNc(191,Pi,2,2,"optgroup",53),e.qZA(),e.YNc(192,Ri,2,1,"span",47),e.qZA()()(),e.TgZ(193,"div",23)(194,"div",10)(195,"div",11)(196,"div",9)(197,"div",54)(198,"label",55),e._uU(199),e.qZA(),e.TgZ(200,"span",14),e._uU(201,"*"),e.qZA()(),e.TgZ(202,"div",56)(203,"span",15),e._UZ(204,"i",16),e.qZA()()(),e.TgZ(205,"input",57),e.NdJ("keydown",function(a){return i.noWhiteSpace(a)}),e.qZA(),e.YNc(206,Yi,2,1,"span",18),e.YNc(207,$i,2,1,"span",18),e.YNc(208,Qi,2,1,"span",18),e.qZA()()(),e.TgZ(209,"div",23)(210,"div",10)(211,"div",11)(212,"div",38),e._UZ(213,"input",58),e.TgZ(214,"label",40),e._uU(215),e.qZA()()(),e.TgZ(216,"div",11)(217,"div",38),e._UZ(218,"input",59),e.TgZ(219,"label",60),e._uU(220),e.qZA()()(),e.TgZ(221,"div",11)(222,"div",38),e._UZ(223,"input",61),e.TgZ(224,"label",62),e._uU(225),e.qZA()()()()(),e.YNc(226,Vi,7,2,"div",63),e.qZA()()()()(),e.TgZ(227,"div",64),e.YNc(228,ji,4,4,"button",65),e.TgZ(229,"button",66),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(230),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.driver),e.xp6(5),e.Q6J("formGroup",i.driverForm),e.xp6(10),e.Oqu(i.locales.name),e.xp6(5),e.cQ8("ngbTooltip","",i.locales.required,". ",i.locales.name_validation," ",i.locales.onlyAlfanumeric,""),e.xp6(1),e.s9C("placeholder",i.locales.driver_name),e.Q6J("ngClass",e.VKq(81,Fe,(null==i.Name?null:i.Name.errors)&&(i.Name.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",(null==i.Name||null==i.Name.errors?null:i.Name.errors.checkAppCharacter)&&(i.Name.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",i.required("name")),e.xp6(1),e.Q6J("ngIf",(i.driverForm.get("name").value.length<2||i.driverForm.get("name").value.length>30)&&(i.Name.touched||2===i.formType)),e.xp6(6),e.Oqu(i.locales.last_name),e.xp6(5),e.cQ8("ngbTooltip","",i.locales.required,". ",i.locales.last_name_validation," ",i.locales.onlyAlfanumeric,""),e.xp6(1),e.s9C("placeholder",i.locales.last_name),e.Q6J("ngClass",e.VKq(83,Fe,(null==i.LastName?null:i.LastName.errors)&&(i.LastName.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("lastName")),e.xp6(1),e.Q6J("ngIf",(null==i.LastName||null==i.LastName.errors?null:i.LastName.errors.checkAppCharacter)&&(i.LastName.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(i.driverForm.get("lastName").value.length<2||i.driverForm.get("lastName").value.length>30)&&(i.LastName.touched||2===i.formType)),e.xp6(4),e.Q6J("ngIf",9===(null==i.loginUser?null:i.loginUser.HOSUserTypeId)||(null==i.moaForUser?null:i.moaForUser.length)>0),e.xp6(6),e.Oqu(i.locales.username),e.xp6(5),e.cQ8("ngbTooltip","",i.locales.required,". ",i.locales.username_val
1idation," ",i.locales.invalidDriverUsername,""),e.xp6(1),e.s9C("placeholder",i.locales.username),e.Q6J("ngClass",e.VKq(85,Fe,(null==i.UserName?null:i.UserName.errors)&&(i.UserName.touched||2===i.formType)))("readonly",i.isUserNameReadOnly()),e.xp6(1),e.Q6J("ngIf",i.required("userName")),e.xp6(1),e.Q6J("ngIf",(null==i.UserName?null:i.UserName.errors)&&(i.UserName.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",i.driverForm.get("userName").value.length<4&&(i.UserName.touched||2===i.formType)),e.xp6(3),e.Q6J("ngIf",5===i.driverPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Q6J("ngIf",5===i.driverPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(7),e.Oqu(i.locales.home_base),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.homebasesList),e.xp6(6),e.Oqu(i.locales.ruleset),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.ruleSetList),e.xp6(3),e.Q6J("ngIf",5==+(null==i.RuleSet?null:i.RuleSet.value)||6==+(null==i.RuleSet?null:i.RuleSet.value)||19==+(null==i.RuleSet?null:i.RuleSet.value)),e.xp6(7),e.Oqu(i.locales.start24),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.piriodTime),e.xp6(6),e.Oqu(i.locales.dvirAccess),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.dvirAccessList),e.xp6(1),e.Q6J("ngIf",i.showActiveWarning),e.xp6(7),e.Oqu(i.locales.active),e.xp6(5),e.Oqu(i.locales.personal),e.xp6(5),e.Oqu(i.locales.yard),e.xp6(5),e.Oqu(i.locales.exemption),e.xp6(7),e.Oqu(i.locales.exemption_reason),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(3),e.Oqu(i.locales.selectExemptionReason),e.xp6(1),e.Q6J("ngForOf",i.exemptionList),e.xp6(1),e.Q6J("ngIf",i.errorExemption),e.xp6(1),e.Q6J("ngIf","Custom Reason"===(null==i.ExemptionReason?null:i.ExemptionReason.value)),e.xp6(7),e.Oqu(i.locales.units),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.FuelUnitCodes),e.xp6(6),e.Oqu(i.locales.registration_state),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.Q6J("ngClass",e.VKq(87,Gi,i.checkValidState()&&(i.State.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",""===i.driver.LicenseState),e.xp6(1),e.Q6J("ngForOf",i.licenseState),e.xp6(1),e.Q6J("ngIf",i.errorSelect),e.xp6(7),e.Oqu(i.locales.license_number),e.xp6(5),e.cQ8("ngbTooltip","",i.locales.required,". ",i.locales.license_number_validation," ",i.locales.appcharactererror,"."),e.xp6(1),e.s9C("placeholder",i.locales.license_number),e.Q6J("ngClass",e.VKq(89,Fe,(null==i.LicenseNumber?null:i.LicenseNumber.errors)&&(i.LicenseNumber.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("licenseNumber")),e.xp6(1),e.Q6J("ngIf",(null==i.LicenseNumber||null==i.LicenseNumber.errors?null:i.LicenseNumber.errors.minlength)&&(i.LicenseNumber.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(null==i.LicenseNumber||null==i.LicenseNumber.errors?null:i.LicenseNumber.errors.checkLicenseNumber)&&(i.LicenseNumber.touched||2===i.formType)),e.xp6(7),e.hij("",i.locales.wifionly," "),e.xp6(5),e.Oqu(i.locales.allow_exemption),e.xp6(5),e.Oqu(i.locales.takeDVIRPhoto),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("ngIf",5===i.driverPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.mk,Q.sg,Q.O5,P._L,c._Y,c.YN,c.Kr,c.Fj,c.Wl,c.EJ,c.JJ,c.JL,c.Q7,c.wO,c.nD,c.sg,c.u,Ve.e,vt],styles:[".form-group[_ngcontent-%COMP%]{margin-bottom:.3rem}"]})}return r})();var Se=F(93719),ee=F(18237),pe=F(73701),Ki=F(55089);function Xi(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.ALo(3,"driverName"),e.qZA()()),2&r){const t=l.$implicit;e.xp6(2),e.Oqu(e.lcZ(3,1,t.data))}}function es(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"dx-data-grid",1),e.NdJ("onSelectionChanged",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.selectionChanged(i))}),e._UZ(2,"dxo-search-panel",2)(3,"dxo-selection",3)(4,"dxi-column",4)(5,"dxi-column",5)(6,"dxi-column",6),e.YNc(7,Xi,4,3,"div",7),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.Q6J("dataSource",t.drivers)("showBorders",!0),e.xp6(1),e.s9C("placeholder",t.locales.search),e.Q6J("visible",!0),e.xp6(2),e.s9C("caption",t.locales.name),e.xp6(1),e.s9C("caption",t.locales.name),e.Q6J("visible",!1),e.xp6(1),e.s9C("caption",t.locales.username),e.xp6(1),e.Q6J("dxTemplateOf","nameTemplate")}}function ts(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"dx-data-grid",8),e.NdJ("onSelectionChanged",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.selectionChanged(i))}),e._UZ(2,"dxo-search-panel",2)(3,"dxo-selection",3)(4,"dxi-column",9)(5,"dxi-column",10)(6,"dxi-column",11),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.Q6J("dataSource",t.assets)("showBorders",!0)("columnHidingEnabled",!0),e.xp6(1),e.s9C("placeholder",t.locales.search),e.Q6J("visible",!0),e.xp6(2),e.s9C("caption",t.locales.number),e.xp6(1),e.s9C("caption",t.locales.vin),e.xp6(1),e.s9C("caption",t.locales.plate)}}let _t=(()=>
1{class r{constructor(){this.onItemsChange=new e.vpe,this.oldSelectedItems=[]}ngOnChanges(t){t.typeNotification?.previousValue!==t.typeNotification?.currentValue&&(this.selectedItems=[],this.dataGrid&&this.dataGrid.instance.deselectRows(this.oldSelectedItems)),this.oldSelectedItems=this.selectedItems}ngAfterViewInit(){"driversTable"===this.tableType&&this.drivers.length>0&&this.drivers.forEach(t=>{this.selectedItems.length>0&&this.selectedItems.forEach(s=>{s===t.HOSDriverId&&this.selectSingleRow(s,!0)})}),"assetsTable"===this.tableType&&this.assets.length>0&&this.assets.forEach(t=>{this.selectedItems.length>0&&this.selectedItems.forEach(s=>{s===t.AssetId&&this.selectSingleRow(s,!0)})}),this.oldSelectedItems=this.selectedItems}selectSingleRow(t,s){this.dataGrid.instance.isRowSelected(t)||this.dataGrid.instance.selectRows([t],s)}deselectRows(t){0===this.selectedItems.length&&t.component.deselectRows(this.selectedItems)}selectionChanged(t){let s=[];t.selectedRowsData.length>0&&("driversTable"===this.tableType&&(s=t.selectedRowsData.map(i=>i.HOSDriverId)),"assetsTable"===this.tableType&&(s=t.selectedRowsData.map(i=>i.AssetId))),this.onItemsChange.emit(s),this.oldSelectedItems=[...s]}static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-items-table"]],viewQuery:function(s,i){if(1&s&&e.Gf(Se.e,5),2&s){let o;e.iGM(o=e.CRH())&&(i.dataGrid=o.first)}},inputs:{drivers:"drivers",assets:"assets",locales:"locales",notificationPermission:"notificationPermission",selectedItems:"selectedItems",tableType:"tableType",typeNotification:"typeNotification",loginUser:"loginUser"},outputs:{onItemsChange:"onItemsChange"},features:[e.TTD],decls:2,vars:2,consts:[[4,"ngIf"],["id","gridContainer","keyExpr","HOSDriverId",3,"dataSource","showBorders","onSelectionChanged"],[3,"visible","placeholder"],["mode","multiple","showCheckBoxesMode","always"],["cellTemplate","nameTemplate","dataField","LastName",3,"caption"],["dataField","Name",3,"visible","caption"],["dataField","HOSUserName",3,"caption"],[4,"dxTemplate","dxTemplateOf"],["id","gridContainer","keyExpr","AssetId",3,"dataSource","showBorders","columnHidingEnabled","onSelectionChanged"],["dataField","Number",3,"caption"],["dataField","VIN",3,"caption"],["dataField","Plate",3,"caption"]],template:function(s,i){1&s&&(e.YNc(0,es,8,9,"div",0),e.YNc(1,ts,7,8,"div",0)),2&s&&(e.Q6J("ngIf","driversTable"===i.tableType),e.xp6(1),e.Q6J("ngIf","assetsTable"===i.tableType))},dependencies:[Q.O5,Se.e,ee.qvW,ee.XXE,ee.Lz9,pe.p6,Ki.r]})}return r})();function is(r,l){if(1&r&&(e.TgZ(0,"option",29),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.Q6J("value",0),e.xp6(1),e.Oqu(t.locales.noHomeBase)}}function ss(r,l){if(1&r&&(e.TgZ(0,"option",30),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.HOSHomeBaseId),e.xp6(1),e.Oqu(t.Name)}}function rs(r,l){if(1&r&&(e.TgZ(0,"div",6)(1,"div",7)(2,"div",4)(3,"div",8)(4,"label",26),e._uU(5),e.qZA(),e.TgZ(6,"span",9),e._uU(7,"*"),e.qZA()(),e.TgZ(8,"div",8)(9,"span",10),e._UZ(10,"i",11),e.qZA()()(),e.TgZ(11,"select",27),e.YNc(12,is,2,2,"option",28),e.YNc(13,ss,2,2,"option",16),e.qZA()()()),2&r){const t=e.oxw();e.xp6(5),e.Oqu(t.locales.home_base),e.xp6(5),e.MGl("ngbTooltip","",t.locales.required,"."),e.xp6(2),e.Q6J("ngIf",2===t.formType&&0===t.notification.HOSHomeBaseId),e.xp6(1),e.Q6J("ngForOf",t.homebasesList)}}function os(r,l){if(1&r&&(e.TgZ(0,"div",6)(1,"div",7)(2,"div",4)(3,"div",8)(4,"label",26),e._uU(5),e.qZA(),e.TgZ(6,"span",9),e._uU(7,"*"),e.qZA()(),e.TgZ(8,"div",8)(9,"span",10),e._UZ(10,"i",11),e.qZA()()(),e.TgZ(11,"select",31)(12,"option",30),e._uU(13),e.qZA()()()()),2&r){const t=e.oxw();
1e.xp6(5),e.Oqu(t.locales.moa),e.xp6(5),e.MGl("ngbTooltip","",t.locales.required,"."),e.xp6(2),e.Q6J("value",t.moaForUser[0].HOSAccountId),e.xp6(1),e.Oqu(t.moaForUser[0].HOSAccountName)}}function ns(r,l){if(1&r&&(e.TgZ(0,"span",32),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.notification_name_validation)}}function as(r,l){if(1&r&&(e.TgZ(0,"span",32),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.appcharactererror)}}function ls(r,l){if(1&r&&(e.TgZ(0,"option",30),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.Q6J("value",-1),e.xp6(1),e.Oqu(t.locales.noti_type)}}function cs(r,l){if(1&r&&(e.TgZ(0,"option",30),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function ds(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.notification_type_validation)}}function ms(r,l){if(1&r&&(e.TgZ(0,"label"),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.emails)}}function us(r,l){if(1&r&&(e.TgZ(0,"label"),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.email)}}const We=function(r){return{"is-invalid":r}};function hs(r,l){if(1&r&&(e.TgZ(0,"input",34),e.NdJ("keypress",function(s){return 32!==s.charCode}),e.qZA()),2&r){const t=e.oxw();e.Q6J("ngClass",e.VKq(1,We,(t.required("emails")||!t.checkEmails())&&(t.Emails.touched||2===t.formType)))}}function ps(r,l){if(1&r&&(e.TgZ(0,"textarea",35),e.NdJ("keypress",function(s){return 32!==s.charCode}),e.qZA()),2&r){const t=e.oxw();e.Q6J("ngClass",e.VKq(1,We,(t.required("emails")||!t.checkEmails())&&(t.Emails.touched||2===t.formType)))}}function fs(r,l){if(1&r&&(e.TgZ(0,"span",32),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(6==+t.Type.value?t.locales.required:t.locales.notification_emails_validation)}}function gs(r,l){if(1&r&&(e.TgZ(0,"span",32),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.invalid_email_format)}}function vs(r,l){if(1&r&&(e.TgZ(0,"label"),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.assets)}}function _s(r,l){if(1&r&&(e.TgZ(0,"label"),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.drivers)}}function Ss(r,l){if(1&r&&(e.TgZ(0,"span",38),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.notification_items_validation)}}function bs(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",7)(1,"div",4)(2,"div",8),e.YNc(3,vs,2,1,"label",18),e.YNc(4,_s,2,1,"label",18),e.TgZ(5,"span",9),e._uU(6,"*"),e.qZA()(),e.TgZ(7,"div",8)(8,"span",10),e._UZ(9,"i",11),e.qZA()()(),e.TgZ(10,"app-items-table",36),e.NdJ("onItemsChange",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.itemsChange(i))}),e.qZA(),e.YNc(11,Ss,2,1,"span",37),e.qZA()}if(2&r){const t=e.oxw();e.xp6(3),e.Q6J("ngIf","assetsTable"===t.tableType),e.xp6(1),e.Q6J("ngIf","driversTable"===t.tableType),e.xp6(5),e.hYB("ngbTooltip","",t.locales.required,". ",t.locales.atLeastOneAD,""),e.xp6(1),e.Q6J("drivers",t.drivers)("assets",t.assets)("locales",t.locales)("tableType",t.tableType)("selectedItems",t.selectedItems)("typeNotification",t.typeNotification)("loginUser",t.loginUser)("notificationPermission",t.notificationPermission),e.xp6(1),e.Q6J("ngIf",t.checkItems)}}function Cs(r,l){if(1&r&&(e.TgZ(0,"div",39)(1,"button",40),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",41),e._uU(5),e.qZA(),e._UZ(6,"div",42),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.Q6J("innerHTML",t.formState.message,e.oJD)}}function Ts(r,l){1&r&&e._UZ(0,"span",46)}function ys(r,l){if(1&r&&(e.TgZ(0,"span",47),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.loading)}}function As(r,l){if(1&r&&(e.TgZ(0,"button",43),e.YNc(1,Ts,1,0,"span",44),e.YNc(2,ys,2,1,"span",45),e._uU(3),e.qZA()),2&r){const t=e.oxw();e.Q6J("disabled",t.form.invalid||t.formState.loading||-1===t.Type.value||0===(null==t.driverItems?null:t.driverItems.length)&&0===(null==t.assetItems?null:t.assetItems.length)||!t.checkEmails()||t.isCheckItemEqual()||0==+t.form.get("homebase").value&&1===t.formType&&(!t.moaForUser||0===t.moaForUser.length)||0==+t.form.get("moa").value&&1===t.formType&&(null==t.moaForUser?null:t.moaForUser.length)>0),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.hij(" ",t.locales.save," ")}}let St=(()=>
1{class r{constructor(t,s,i,o){this.fb=t,this.authService=s,this.utilService=i,this.hosService=o,this.onTypeChange=new e.vpe,this.onSubmitForm=new e.vpe,this.onModalClose=new e.vpe,this.onSubmit=new e.vpe,this.driverItems=[],this.assetItems=[],this.selectedItems=[],this.checkItems=!1,this.formChanged=!1,this.requiredHomeBase=!1,this.oldSelectedItems=[],this.showSelectError=!1,this.errorSelect=!1}ngAfterViewInit(){this.moaForUser?.length>0?$("#moa").select2():$("#homebase").select2(),$("#type").select2(),$("#homebase").on("change",t=>{this.HomeBase.setValue(t.target.value),this.homeBaseChange(t.target.value)}),$("#moa").on("change",t=>{this.Moa.setValue(t.target.value)}),$("#type").on("change",t=>{this.driverItems=[],this.assetItems=[],this.onTypeChange.emit(t.target.value),this.typeNotification=+t.target.value,this.form.markAsDirty(),this.form.get("type").setValue(t.target.value),-1==+t.target.value?(this.errorSelect=!0,setTimeout(()=>{$("#type").select2({containerCssClass:"invalid-color"})},50)):(this.errorSelect=!1,setTimeout(()=>{$("#type").select2()},50))})}ngOnInit(){this.loginUser&&this.getNotificationPermission(),this.driverList=this.drivers,this.assetList=this.assets,this.form=this.fb.group({homebase:[{value:this.notification.HOSHomeBaseId,disabled:2===this.formType},[c.kI.required]],moa:[{value:this.moaForUser?.length>0?this.moaForUser[0].HOSAccountId:0,disabled:!0}],name:[this.notification.Name,[c.kI.required,u.s.checkAppCharactersOnly]],type:[this.notification.Type,[c.kI.required]],emails:[this.notification.Emails,[c.kI.required]],items:["",[]]}),(!this.moaForUser||0===this.moaForUser.length)&&(this.getHomebases(),this.homeBaseChange(this.mainOfficeId)),this.checkSelectedItems(),10===this.notificationPermission&&this.loginUser&&6!==this.loginUser.HOSUserTypeId&&7!==this.loginUser.HOSUserTypeId&&this.form.disable()}ngOnDestroy(){$(".select2-container").removeClass("select2-container--open"),$("#type").remove(),$("#homebase").remove(),$("#moa").remove(),(!this.moaForUser||0===this.moaForUser.length)&&this.homebasesList.find(i=>0===i.HOSHomeBaseId)&&this.homebasesList.shift()}getNotificationPermission(){this.notificationPermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>9===s)?9:10}getHomebases(){if(this.hosService.homeBasesAdmin&&this.hosService.homeBasesAdmin.length>0){if(this.homebasesList=this.hosService.homeBasesAdmin,this.requiredHomeBase=!0,0===this.notification.HOSHomeBaseId||!this.notification.HOSHomeBaseId){if(2===this.formType)this.mainOfficeId=0;else{let t=this.homebasesList.find(s=>
11===s.DefaultHome);this.mainOfficeId=t?t.HOSHomeBaseId:this.homebasesList[0].HOSHomeBaseId}this.HomeBase.setValue(this.mainOfficeId)}}else this.homebasesList=[],this.homebasesList.push({HOSHomeBaseId:0,Name:this.locales.noHomeBase}),this.requiredHomeBase=!1,1===this.formType&&(this.formState={loading:!1,submited:!1,errors:!0,message:this.locales.noHomebaseCreated}),this.HomeBase.setValue(this.homebasesList[0].HOSHomeBaseId);1===this.formType&&this.Type.setValue(-1)}getTypeList(){return 1!==this.currentCarrier?.WorkOrderEnabled||this.moaForUser&&0!==this.moaForUser.length?6===this.notification.Type?this.notificationType:this.notificationType.filter(t=>6!==t.key):this.notificationType}checkEmails(){return 6==+this.Type.value?this.validateEmail(this.Emails.value):this.validateEmailList(this.Emails.value)}findHomeBase(t){return this.homebasesList.find(s=>s.HOSHomeBaseId===t)}validateEmail(t){return/^[A-Z0-9+._-]+@[A-Z0-9._-]+\.[A-Z0-9]{1,}$/i.test(t)}validateEmailList(t){let s=t.match(/[^\s,]+/g),i=!0;return s&&s.length>0&&s.forEach(o=>{this.validateEmail(o)||(i=!1)}),i}get Name(){return this.form.get("name")}get Emails(){return this.form.get("emails")}get Type(){return this.form.get("type")}get Items(){return this.form.get("items")}get HomeBase(){return this.form.get("homebase")}get Moa(){return this.form.get("moa")}get invalidEmail(){return this.Emails.hasError("invalidEmail")}required(t){return this.form.get(`${t}`).hasError("required")&&(this.form.get(`${t}`).touched||2===this.formType)}checkSelectedItems(){this.selectedItems=[],"driversTable"===this.tableType&&(this.selectedItems=[...this.notification.Drivers],this.oldSelectedItems=this.selectedItems),"assetsTable"===this.tableType&&(this.selectedItems=[...this.notification.Assets],this.oldSelectedItems=this.selectedItems)}homeBaseChange(t){(9===this.notificationPermission&&this.loginUser||!this.loginUser||this.loginUser&&(6===this.loginUser.HOSUserTypeId||7===this.loginUser.HOSUserTypeId))&&(this.drivers=[...this.driverList],this.assets=[...this.assetList],this.drivers&&this.drivers.length>0&&(1===this.formType?this.drivers=this.drivers.filter(s=>s.HOSHomeBaseId===+t):0!==this.notification.HOSHomeBaseId&&(this.drivers=this.drivers.filter(s=>s.HOSHomeBaseId===this.notification.HOSHomeBaseId))),this.assets&&this.assets.length>0&&(1===this.formType?this.assets=this.assets.filter(s=>s.HOSHomeBaseId===+t):0!==this.notification.HOSHomeBaseId&&(this.assets=this.assets.filter(s=>s.HOSHomeBaseId===this.notification.HOSHomeBaseId))))}notificationTypeChange(t){(9===this.notificationPermission&&this.loginUser||!this.loginUser||this.loginUser&&(6===this.loginUser.HOSUserTypeId||7===this.loginUser.HOSUserTypeId))&&(this.driverItems=[],this.assetItems=[],this.onTypeChange.emit(t),this.typeNotification=+t)}itemsChange(t){this.driverItems=[],this.assetItems=[],"driversTable"===this.tableType&&(this.driverItems=[...t],this.oldSelectedItems=this.driverItems),"assetsTable"===this.tableType&&(this.assetItems=[...t],this.oldSelectedItems=this.assetItems)}onValueAdd(t,s){let i=t.trim();this.form.get(`${s}`).setValue(i)}findNotificationType(t){return this.notificationType.find(s=>s.key===t&&-1!==t)}submitForm(){let t="";this.form.invalid&&(t=this.locales.invalidForm+"<br/>"),0===this.driverItems?.length&&0===this.assetItems?.length&&(t+=this.locales.atLeastOneAD+"<br/>"),this.findNotificationType(parseInt(this.form.value.type))||(t+=this.locales.invalidNotiType+"<br/>"),(!this.moaForUser||0===this.moaForUser.length)&&!this.findHomeBase(parseInt(this.form.value.homebase))&&1===this.formType&&(t+=this.locales.invalidHomeBase+"<br/>"),2===this.formType&&this.notification.HOSHomeBaseId!==parseInt(this.HomeBase.value)&&(t+=this.locales.invalidChangeHomeBase+"<br/>"),""===this.form.value.emails&&(t+=this.locales.emptyEmail+"<br/>"),6===parseInt(this.form.value.type)&&!this.validateEmail(this.form.value.emails)&&(t+=this.locales.invalidEmailFormat+"<br/>"),6!==parseInt(this.form.value.type)&&!this.validateEmailList(this.form.value.emails)&&(t+=this.locales.invalidEmailFormat+"<br/>"),(!this.moaForUser||0===this.moaForUser.length)&&0===this.form.value.homebase&&1===this.formType&&(t+=this.locales.homeBaseRequired+"<br/>"),""!==t?this.formState={loading:!1,submited:!1,errors:!0,message:t}:this.onSubmitForm.emit({Name:this.form.value.name,Type:parseInt(this.form.value.type),Emails:this.form.value.emails.toLowerCase(),Drivers:this.driverItems.length>0?this.driverItems:null,Assets:this.assetItems.length>0?this.assetItems:null,HomeBase:1===this.formType?parseInt(this.form.value.homebase):this.notification.HOSHomeBaseId,Account:1===this.formType?parseInt(this.Moa.value):this.notification.HOSAccountId})}closeModal(){this.onModalClose.emit()}isCheckItemEqual(){let t=!0;return t=this.oldSelectedItems.toString()===this.selectedItems.toString()&&!this.form.dirty,t}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(c.QS),e.Y36(p.e),e.Y36(b.f),e.Y36(y.T))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["notification-form"]],inputs:{drivers:"drivers",assets:"assets",notification:"notification",notificationType:"notificationType",tableType:"tableType",locales:"locales",formType:"formType",formState:"formState",currentCarrier:"currentCarrier",loginUser:"loginUser",moaForUser:"moaForUser"},outputs:{onTypeChange:"onTypeChange",onSubmitForm:"onSubmitForm",onModalClose:"onModalClose",onSubmit:"onSubmit"},decls:58,vars:31,consts:[["role","form","novalidate","",3,"formGroup","ngSubmit"],[1,"card-body"],[1,"card","border-dark","mb-3",2,"width","100%"],[1,"card-body","text-dark","my_card-body"],[1,"row"],["class","col-sm-6",4,"ngIf"],[1,"col-sm-6"],[1,"form-group"],[1,"col-6"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["type","text","formControlName","name","required","",1,"form-control",3,"ngClass","placeholder","change"],["class","error invalid-feedback",4,"ngIf"],["formControlName","type","id","type",1,"form-control",2,"width","100%",3,"ngClass"],[3,"value",4,"ngIf"],[3,"value",4,"ngFor","ngForOf"],["class","invali
1d-select",4,"ngIf"],[4,"ngIf"],["type","email","class","form-control","formControlName","emails","placeholder","[email protected]","style","text-transform: lowercase;","required","",3,"ngClass","keypress",4,"ngIf"],["class","form-control","formControlName","emails","placeholder","[email protected],[email protected],[email protected]","style","text-transform: lowercase;","required","",3,"ngClass","keypress",4,"ngIf"],["class","form-group",4,"ngIf"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"card-footer"],["type","submit","class","btn btn-primary",3,"disabled",4,"ngIf"],["type","button",1,"btn","btn-outline-dark","float-right",3,"click"],["for","homebase"],["formControlName","homebase","id","homebase",1,"form-control",2,"width","100%"],["selected","true",3,"value",4,"ngIf"],["selected","true",3,"value"],[3,"value"],["formControlName","moa","id","moa",1,"form-control",2,"width","100%"],[1,"error","invalid-feedback"],[1,"invalid-select"],["type","email","formControlName","emails","placeholder","[email protected]","required","",1,"form-control",2,"text-transform","lowercase",3,"ngClass","keypress"],["formControlName","emails","placeholder","[email protected],[email protected],[email protected]","required","",1,"form-control",2,"text-transform","lowercase",3,"ngClass","keypress"],[3,"drivers","assets","locales","tableType","selectedItems","typeNotification","loginUser","notificationPermission","onItemsChange"],["class","error",4,"ngIf"],[1,"error"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"],[3,"innerHTML"],["type","submit",1,"btn","btn-primary",3,"disabled"],["class","spinner-border spinner-border-sm","role","status","aria-hidden","true",4,"ngIf"],["class","sr-only",4,"ngIf"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"sr-only"]],template:function(s,i){1&s&&(e.TgZ(0,"form",0),e.NdJ("ngSubmit",function(){return i.submitForm()}),e.TgZ(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4),e.YNc(5,rs,14,4,"div",5),e.YNc(6,os,14,4,"div",5),e.TgZ(7,"div",6)(8,"div",7)(9,"div",4)(10,"div",8)(11,"label"),e._uU(12),e.qZA(),e.TgZ(13,"span",9),e._uU(14,"*"),e.qZA()(),e.TgZ(15,"div",8)(16,"span",10),e._UZ(17,"i",11),e.qZA()()(),e.TgZ(18,"input",12),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"name")}),e.qZA(),e.YNc(19,ns,2,1,"span",13),e.YNc(20,as,2,1,"span",13),e.qZA()()(),e.TgZ(21,"div",4)(22,"div",6)(23,"div",7)(24,"div",4)(25,"div",8)(26,"label"),e._uU(27),e.qZA(),e.TgZ(28,"span",9),e._uU(29,"*"),e.qZA()(),e.TgZ(30,"div",8)(31,"span",10),e._UZ(32,"i",11),e.qZA()()(),e.TgZ(33,"select",14),e.YNc(34,ls,2,2,"option",15),e.YNc(35,cs,2,2,"option",16),e.qZA(),e.YNc(36,ds,2,1,"span",17),e.qZA()(),e.TgZ(37,"div",6)(38,"div",7)(39,"div",4)(40,"div",8),e.YNc(41,ms,2,1,"label",18),e.YNc(42,us,2,1,"label",18),e.TgZ(43,"span",9),e._uU(44,"*"),e.qZA()(),e.TgZ(45,"div",8)(46,"span",10),e._UZ(47,"i",11),e.qZA()()(),e.YNc(48,hs,1,3,"input",19),e.YNc(49,ps,1,3,"textarea",20),e.YNc(50,fs,2,1,"span",13),e.YNc(51,gs,2,1,"span",13),e.qZA()()(),e.YNc(52,bs,12,13,"div",21),e.YNc(53,Cs,7,2,"div",22),e.qZA()()(),e.TgZ(54,"div",23),e.YNc(55,As,4,4,"button",24),e.TgZ(56,"button",25),e.NdJ("click",function(){return i.closeModal()}),e._uU(57),e.qZA()()()),2&s&&(e.Q6J("formGroup",i.form),e.xp6(5),e.Q6J("ngIf",!i.moaForUser||0===i.moaForUser.length),e.xp6(1),e.Q6J("ngIf",(null==i.moaForUser?null:i.moaForUser.length)>0),e.xp6(6),e.Oqu(i.locales.name),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.s9C("placeholder",i.locales.notificationName),e.Q6J("ngClass",e.VKq(27,We,(null==i.Name?null:i.Name.errors)&&(i.Name.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("name")),e.xp6(1),e.Q6J("ngIf",(null==i.Name||null==i.Name.errors?null:i.Name.errors.checkAppCharacter)&&(i.Name.touched||2===i.formType)),e.xp6(7),e.Oqu(i.locales.type),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.Q6J("ngClass",e.VKq(29,We,"-1"===i.Type.value&&(i.Type.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",1===i.formType),e.xp6(1),e.Q6J("ngForOf",i.getTypeList()),e.xp6(1),e.Q6J("ngIf",i.errorSelect),e.xp6(5),e.Q6J("ngIf",6!=+i.Type.value),e.xp6(1),e.Q6J("ngIf",6==+i.Type.value),e.xp6(5),e.hYB("ngbTooltip","",i.locales.required,". ",i.locales.validEmailFormat,""),e.xp6(1),e.Q6J("ngIf",6==+i.Type.value),e.xp6(1),e.Q6J("ngIf",6!=+i.Type.value),e.xp6(1),e.Q6J("ngIf",i.required("emails")),e.xp6(1),e.Q6J("ngIf",i.Emails.invalid&&(i.Emails.touched||2===i.formType)&&""!==i.Emails.value||!i.checkEmails()),e.xp6(1),e.Q6J("ngIf",-1!=+i.Type.value),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("ngIf",9===i.notificationPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.mk,Q.sg,Q.O5,c._Y,c.YN,c.Kr,c.Fj,c.EJ,c.JJ,c.JL,c.Q7,c.sg,c.u,P._L,_t],styles:[".error{color:#c0392b}.input-email-ex{color:#6c757d;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:100;font-size:.8rem}\n"],encapsulation:2})}return r})(),st=(()=>
1{class r{constructor(t,s){this.activeModal=t,this.hosService=s,this.onSubmit=new e.vpe}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close()}ngOnInit(){this.loginUser=this.hosService.loginUser,this.notificationTypeChange(this.notification.Type)}notificationTypeChange(t){(2===parseInt(t)||4===parseInt(t)||parseInt(t)>=7)&&(this.tableType="driversTable"),(1===parseInt(t)||3===parseInt(t)||5===parseInt(t)||6===parseInt(t))&&(this.tableType="assetsTable"),-1===parseInt(t)&&(this.tableType=null)}closeModal(t){this.activeModal.dismiss("Click close btn")}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(y.T))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["notification-modal"]],inputs:{drivers:"drivers",assets:"assets",notification:"notification",tableType:"tableType",formType:"formType",notificationTypes:"notificationTypes",locales:"locales",formState:"formState",currentCarrier:"currentCarrier",moaForUser:"moaForUser"},outputs:{onSubmit:"onSubmit"},decls:8,vars:12,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],["ngbAutofocus","",1,"modal-body"],[3,"drivers","assets","notification","notificationType","tableType","locales","formState","formType","currentCarrier","moaForUser","loginUser","onSubmitForm","onModalClose","onTypeChange"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"notification-form",5),e.NdJ("onSubmitForm",function(a){return i.onSubmit.emit(a)})("onModalClose",function(a){return i.closeModal(a)})("onTypeChange",function(a){return i.notificationTypeChange(a)}),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.notification),e.xp6(5),e.Q6J("drivers",i.drivers)("assets",i.assets)("notification",i.notification)("notificationType",i.notificationTypes)("tableType",i.tableType)("locales",i.locales)("formState",i.formState)("formType",i.formType)("currentCarrier",i.currentCarrier)("moaForUser",i.moaForUser)("loginUser",i.loginUser))},dependencies:[St]})}return r})();const Is=["mapContainer"];let rt=(()=>{class r{constructor(){this.onClickedMap=new e.vpe,this.zoom=12}ngOnInit(){const{latitude:t,longitude:s}=this.parent.get("marker").value;this.latitude=t,this.longitude=s,this.marker={lat:t,lng:s,draggable:!1}}ngAfterViewInit(){this.mapInitializer()}onResize(t){this.changeMarker(this.latitude,this.longitude)}mapClicked(t){(3===this.homeBasePermission&&this.loginUser||!this.loginUser||this.loginUser&&(6===this.loginUser.HOSUserTypeId||7===this.loginUser.HOSUserTypeId))&&(this.markerMap.setPosition(t.latLng),this.parent.get("marker").get("latitude").setValue(parseFloat(this.markerMap.getPosition().lat().toFixed(4))),this.parent.get("marker").get("longitude").setValue(parseFloat(this.markerMap.getPosition().lng().toFixed(4))),this.parent.get("latitude").setValue(parseFloat(this.markerMap.getPosition().lat().toFixed(4))),this.parent.get("longitude").setValue(parseFloat(this.markerMap.getPosition().lng().toFixed(4))),this.onClickedMap.emit({lat:parseFloat(this.markerMap.getPosition().lat().toFixed(4)),lng:parseFloat(this.markerMap.getPosition().lng().toFixed(4))}),this.latitude=parseFloat(this.markerMap.getPosition().lat().toFixed(4)),this.longitude=parseFloat(this.markerMap.getPosition().lng().toFixed(4)))}changeMarker(t,s){this.markerMap.setPosition({lat:t,lng:s}),this.map.setCenter({lat:t,lng:s}),this.latitude=t,this.longitude=s}mapInitializer(){let t=new google.maps.LatLng(this.latitude,this.longitude);this.mapOptions={center:t,zoom:this.zoom,mapTypeControl:!1,fullscreenControl:!1},this.map=new google.maps.Map(document.getElementById("map"),this.mapOptions),this.markerMap=new google.maps.Marker({position:{lat:this.latitude,lng:this.longitude},map:this.map,draggable:!1}),google.maps.event.addListener(this.map,"click",s=>{this.mapClicked(s)})}static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-homebase-map"]],viewQuery:function(s,i){if
1(1&s&&e.Gf(Is,5),2&s){let o;e.iGM(o=e.CRH())&&(i.gmap=o.first)}},hostBindings:function(s,i){1&s&&e.NdJ("resize",function(a){return i.onResize(a)},!1,e.Jf7)},inputs:{parent:"parent",homeBasePermission:"homeBasePermission",loginUser:"loginUser"},outputs:{onClickedMap:"onClickedMap"},decls:4,vars:1,consts:[[3,"formGroup"],["formGroupName","marker"],["id","map"],["mapContainer",""]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1),e._UZ(2,"div",2,3),e.qZA()()),2&s&&e.Q6J("formGroup",i.parent)},dependencies:[c.JL,c.sg,c.x0],styles:["#map[_ngcontent-%COMP%]{height:650px!important;width:100%!important}@media (min-width: 200px) and (max-width: 1024px){#map[_ngcontent-%COMP%]{height:300px!important;width:100%!important}}"]})}return r})();var Je=F(58987);let bt=(()=>{class r{constructor(t,s){this.utilService=t,this.http=s,this.geocoder=new google.maps.Geocoder,this.geos=[]}codeAddress(t){return(0,_.of)(this.geocoder.geocode({address:t},function(s,i){}))}getAddressByLatLng(t,s){let i=new google.maps.LatLng(t,s);return(0,_.of)(this.geocoder.geocode({location:i},function(o,a){}))}formatJSONUSA(){const t={country:"USA",code:"US",states:[]};if(!this.dataUSA)return void this.http.get("/assets/geo/states-usa.json").subscribe(i=>{this.dataUSA=i,this.formatJSONUSA()});const s=this.dataUSA.features;for(let i=0;i<s.length;i++){const o={name:"",code:"",polygons:[]};let a=s[i].properties.name;const m=this.utilService.licenseState.find(L=>"USA"===L.name).states.find(L=>L.state===a);o.name=a,o.code=m?m.value:"";const Z=s[i].geometry.coordinates;let H=[],w=[];if("Polygon"===s[i].geometry.type){const L=Z[0],Y=[];for(let E=0;E<L.length;E++){const G=L[E][1],z=L[E][0];H.push(G),w.push(z),Y.push([G,z])}const W={maxLat:Math.max(...H),maxLng:Math.max(...w),minLat:Math.min(...H),minLng:Math.min(...w),coordinates:Y};o.polygons=[W],t.states.push(o)}else{let L=[];for(let Y=0;Y<Z.length;Y++){const W=Z[Y];for(let E=0;E<W.length;E++){const G=W[E];let z=[];for(let j=0;j<G.length;j++){const se=G[j][1],ie=G[j][0];H.push(se),w.push(ie),z.push([se,ie])}const te={maxLat:Math.max(...H),maxLng:Math.max(...w),minLat:Math.min(...H),minLng:Math.min(...w),coordinates:[...z]};H=[],w=[],z=[],L.push(te)}}o.polygons=[...L],L=[],t.states.push(o)}}}formatJSONCanada(){const t={country:"CANADA",code:"CAN",states:[]};if(!this.statesCanada)return void this.http.get("/assets/geo/states-canada.json").subscribe(i=>{this.statesCanada=i,this.formatJSONCanada()});const s=this.statesCanada.features;for(let i=0;i<s.length;i++){const o={name:"",code:"",polygons:[]};let a=s[i].properties.prov_name_en[0];const m=this.utilService.licenseState.find(L=>"CANADA"===L.name).states.find(L=>L.state===a);o.name=a,o.code=m?m.value:"";const Z=s[i].geometry.coordinates;let H=[],w=[];if("Polygon"===s[i].geometry.type){const L=Z[0],Y=[];for(let E=0;E<L.length;E++){const G=L[E][1],z=L[E][0];H.push(G),w.push(z),Y.push([G,z])}const W={maxLat:Math.max(...H),maxLng:Math.max(...w),minLat:Math.min(...H),minLng:Math.min(...w),coordinates:Y};o.polygons=[W],t.states.push(o)}else{let L=[];for(let Y=0;Y<Z.length;Y++){const W=Z[Y];for(let E=0;E<W.length;E++){const G=W[E];let z=[];for(let j=0;j<G.length;j++){const se=G[j][1],ie=G[j][0];H.push(se),w.push(ie),z.push([se,ie])}const te={maxLat:Math.max(...H),maxLng:Math.max(...w),minLat:Math.min(...H),minLng:Math.min(...w),coordinates:[...z]};H=[],w=[],z=[],L.push(te)}}o.polygons=[...L],L=[],t.states.push(o)}}}JSONCanada(){}formatJSONMexico(){const t={country:"MEXICO",code:"MEX",states:[]};if(!this.statesMexico)return void this.http.get("/assets/geo/states-mexico.json").subscribe(i=>{this.statesMexico=i,this.formatJSONMexico()});const s=this.statesMexico.features;for(let i=0;i<s.length;i++){const o={name:"",code:"",polygons:[]};let a=s[i].properties.state_name;const m=this.utilService.licenseState.find(L=>"MEXICO"===L.name).states.find(L=>L.state===a);o.name=a,o.code=m?m.value:"";const Z=s[i].geometry.coordinates;let H=[],w=[];if("Polygon"===s[i].geometry.type){const L=Z[0],Y=[];for(let E=0;E<L.length;E++){const G=L[E][1],z=L[E][0];H.push(G),w.push(z),Y.push([G,z])}const W={maxLat:Math.max(...H),maxLng:Math.max(...w),minLat:Math.min(...H),minLng:Math.min(...w),coordinates:Y};o.polygons=[W],t.states.push(o)}else{let L=[];for(let Y=0;Y<Z.length;Y++){const W=Z[Y];for(let E=0;E<W.length;E++){const G=W[E];let z=[];for(let j=0;j<G.length;j++){const se=G[j][1],ie=G[j][0];H.push(se),w.push(ie),z.push([se,ie])}const te={maxLat:Math.max(...H),maxLng:Math.max(...w),minLat:Math.min(...H),minLng:Math.min(...w),coordinates:[...z]};H=[],w=[],z=[],L.push(te)}}o.polygons=[...L],L=[],t.states.push(o)}}}JSONMexico(){}static#e=this.\u0275fac=function(s){return new(s||r)(e.LFG(b.f),e.LFG
1(Je.eN))};static#t=this.\u0275prov=e.Yz7({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();function xs(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function Os(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.appcharactererror)}}function Us(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function Zs(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.appcharactererror)}}function ws(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",34),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.getCoordinates())}),e._UZ(1,"i",35),e.qZA()}if(2&r){const t=e.oxw();e.s9C("title",t.locales.getCoordinates),e.Q6J("disabled",""===(null==t.Address?null:t.Address.value))}}function Ns(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function Hs(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.invalidLat)}}function Ds(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function Fs(r,l){if(1&r&&(e.TgZ(0,"span",33),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.invalidLng)}}function Ms(r,l){if(1&r&&(e.TgZ(0,"option",36),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.Oqu(t.label)}}function ks(r,l){if(1&r&&(e.TgZ(0,"div",12)(1,"div",37),e._UZ(2,"input",38),e.TgZ(3,"label",39),e._uU(4),e.qZA()()()),2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.set_main_office)}}function qs(r,l){if(1&r&&(e.TgZ(0,"div",40)(1,"button",41),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",42),e._uU(5),e.qZA(),e._UZ(6,"div",43),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.Q6J("innerHTML",t.formState.message,e.oJD)}}function Ls(r,l){1&r&&e._UZ(0,"span",47)}function Js(r,l){if(1&r&&(e.TgZ(0,"span",48),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.loading)}}function Bs(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",44),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.submitForm())}),e.YNc(1,Ls,1,0,"span",45),e.YNc(2,Js,2,1,"span",46),e._uU(3),e.qZA()}if(2&r){const t=e.oxw();
1e.Q6J("disabled",t.homebaseForm.invalid||t.formState.loading||!t.homebaseForm.dirty),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.hij(" ",t.locales.save," ")}}const ze=function(r){return{"is-invalid":r}};let ot=(()=>{class r{constructor(t,s,i,o,a,d,m){this.activeModal=t,this.fb=s,this.utilService=i,this.hosService=o,this.mapService=a,this.eventBus=d,this.toast=m,this.onSubmit=new e.vpe,this.showMainOfficeBit=!1,this.lat=41.2852,this.long=-99.2184,this.hasMainOffice=!0,this.zoom=12,this.markers=[],this.selectChanged=!1,this.formType=1,this.inputTextLength=0,this.homeBaseModalSub=new V.w}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close()}ngOnInit(){if(this.loginUser=this.hosService.loginUser,this.showMainOfficeBit=!this.loginUser||this.loginUser.HOSRole.HOSRoleId<=5,this.loginUser&&this.getHomeBaseModelPermission(),this.homebase.HOSHomeBaseId>0&&(this.formType=2),this.loginUser&&10===this.loginUser.HOSUserTypeId&&this.loginUser.MOAHomeBaseIds.length>0){const t=this.hosService.homeBasesAdmin.findIndex(s=>s.DefaultHome);this.hasMainOffice=-1!==t}this.homebaseForm=this.fb.group({marker:this.fb.group({latitude:[2===this.formType?this.homebase.Latitude:this.lat],longitude:[2===this.formType?this.homebase.Longitude:this.long]}),locationName:[this.homebase.Name,[c.kI.required,u.s.checkAppCharactersOnly]],address:[this.homebase.Address,[c.kI.required,u.s.checkNameAndAddress]],latitude:[2===this.formType?this.homebase.Latitude:this.lat,[c.kI.required,u.s.checkCoordinates]],longitude:[2===this.formType?this.homebase.Longitude:this.long,[c.kI.required,u.s.checkCoordinates]],timezone:[this.homebase.TimeZoneCode],mainoffice
1:[{value:this.mainoffice?.mainoffice,disabled:this.mainoffice?.disabled}]}),4===this.homeBasePermission&&this.loginUser&&6!==this.loginUser.HOSUserTypeId&&7!==this.loginUser.HOSUserTypeId&&this.homebaseForm.disable(),this.inputTextLength=1===this.formType?0:this.homebase.Address.length}getRemainingText(){this.inputTextLength=this.Address.value.length}getHomeBaseModelPermission(){this.homeBasePermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>3===s)?3:4}ngAfterViewInit(){$("#timezone").select2(),$("#timezone").on("change",t=>{this.homebaseForm.get("timezone").setValue(t.target.value),this.homebaseForm.markAsDirty()})}ngOnDestroy(){$(".select2-container").removeClass("select2-container--open"),$("#timezone").remove(),this.homeBaseModalSub.unsubscribe()}onValueAdd(t,s){let i=t.trim();this.homebaseForm.get(`${s}`).setValue(i),("latitude"===s||"longitude"===s)&&(this.Latitude.setValue(parseFloat((+this.Latitude.value).toFixed(4))),this.Longitude.setValue(parseFloat((+this.Longitude.value).toFixed(4))),this.homebaseMap.changeMarker(+this.Latitude.value,+this.Longitude.value)),"address"===s&&(this.inputTextLength=this.Address.value.length)}submitForm(){const{locationName:t,address:s,timezone:a,mainoffice:d}=this.homebaseForm.value;let m="";
1this.homebaseForm.invalid&&(m=this.locales.invalidForm+"<br/>"),this.utilService.numbersPositivesAndNegatives(this.homebaseForm.get("latitude").value)||(m+=this.locales.invalidLat+"<br/>"),this.utilService.numbersPositivesAndNegatives(this.homebaseForm.get("longitude").value)||(m+=this.locales.invalidLng+"<br/>"),this.utilService.findTimeZone(+a)||(m+=this.locales.invalidTimeZone),""!==m?this.formState={loading:!1,submited:!1,errors:!0,message:m}:(this.homebase.DefaultHome=this.hasMainOffice?this.mainoffice?.mainoffice?+this.mainoffice?.mainoffice:+d:1===this.formType?0:this.homebase.DefaultHome,this.homebase.Name=t,this.homebase.Address=s,this.homebase.Latitude=this.homebaseForm.get("latitude").value,this.homebase.Longitude=this.homebaseForm.get("longitude").value,this.homebase.TimeZoneCode=a,this.homebase.HOSAccountId=this.loginUser&&9===this.loginUser.HOSUserTypeId||this.hosService.moaForUser?.length>0?this.hosService.moaForUser[0].HOSAccountId:0,this.onSubmit.emit(JSON.parse(JSON.stringify(this.homebase))))}get LocationName(){return this.homebaseForm.get("locationName")}get Address(){return this.homebaseForm.get("address")}get Latitude(){return this.homebaseForm.get("latitude")}get Longitude(){return this.homebaseForm.get("longitude")}required(t){return this.homebaseForm.get(`${t}`).hasError("required")&&(this.homebaseForm.get(`${t}`).touched||2===this.formType)}clickedMapChange(t){this.mapService.getAddressByLatLng(t.lat,t.lng).subscribe(s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),s.then(i=>{this.Address.setValue(i.results[1].formatted_address),this.inputTextLength=this.Address.value.length,this.Address.markAsTouched()}).catch(i=>{this.Address.setValue(""),this.inputTextLength=0,this.Address.markAsTouched()})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.Address.setValue(""),this.inputTextLength=0,this.Address.markAsTouched()}),this.homebaseForm.markAsDirty()}getCoordinates(){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.Address.invalid?(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.invalidAddress,{style:this.utilService.errorStyleMsg,duration:3500,dismissible:!0})):this.homeBaseModalSub.add(this.mapService.codeAddress(this.Address.value).subscribe(t=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),t.then(s=>{let i={lat:s.results[0].geometry.location.lat().toFixed(4),lng:s.results[0].geometry.location.lng().toFixed(4)};this.showCoordinates(i,!0)}).catch(s=>{this.showCoordinates({lat:0,lng:0},!1)})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.showCoordinates({lat:0,lng:0},!1)}))}showCoordinates(t,s){let i=`${s?this.locales.validAddress:this.locales.notFoundCoordinates} <br> \n ${this.locales.latitude}: ${t.lat} <br>\n ${this.locales.longitude}: ${t.lng}`;s?this.toast.success(i,{style:this.utilService.successStyleMsg,duration:5e3,dismissible:!0}):this.toast.error(i,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.Latitude.setValue(t.lat),this.Longitude.setValue(t.lng),this.homebaseMap.changeMarker(+this.Latitude.value,+this.Longitude.value),this.homebaseForm.markAsDirty()}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(c.QS),e.Y36(b.f),e.Y36(y.T),e.Y36(bt),e.Y36(n.Yd),e.Y36(N.jE))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["homebase-modal-form"]],viewQuery:function(s,i){if(1&s&&e.Gf(rt,5),2&s){let o;e.iGM(o=e.CRH())&&(i.homebaseMap=o.first)}},inputs:{homebase:"homebase",locales:"locales",mainoffice:"mainoffice",timezones:"timezones",formState:"formState"},outputs:{onSubmit:"onSubmit"},decls:102,vars:51,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["role","form","id","homebaseForm","novalidate","",3,"formGroup","ngSubmit"],["ngbAutofocus","",1,"card-body"],[1,"row"],[1,"col-md-8"],[3,"parent","homeBasePermission","loginUser","onClickedMap"],[1,"col-md-4"],[1,"col-md"],[1,"form-group"],[1,"col-6"],["for","ruleset"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["type","text","formControlName","locationName",1,"form-control",3,"ngClass","placeholder","change"],["class","error invalid-feedback",4,"ngIf"],["maxlength","150","formControlName","address",1,"form-control","textarea-width",3,"ngClass","placeholder","change","input"],[1,"remaining"],[1,"col-2"],["type","button","class","btn btn-info button-map",3,"disabled","title","click",4,"ngIf"],["type","number","formControlName","latitude","maxlength","30","required","",1,"form-control",3,"ngClass","placeholder","change"],["type","number","formControlName","longitude","maxlength","30","required","",1,"form-control",3,"ngClass","placeholder","change"],["formControlName","timezone","id","timezone","required","",1,"form-control",2,"width","100%"],[3,"value",4,"ngFor","ngForOf"],["class","form-group",4,"ngIf"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"modal-footer"],["type","button","class","btn btn-primary",3,"disabled","click",4,"ngIf"],["type","button",1,"btn","btn-outline-dark",3,"click"],[1,"error","invali
1d-feedback"],["type","button",1,"btn","btn-info","button-map",3,"disabled","title","click"],[1,"fas","fa-map-marker-alt"],[3,"value"],[1,"form-check"],["type","checkbox","formControlName","mainoffice",1,"form-check-input"],["for","mainoffice",1,"form-check-label"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"],[3,"innerHTML"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["class","spinner-border spinner-border-sm","role","status","aria-hidden","true",4,"ngIf"],["class","sr-only",4,"ngIf"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"sr-only"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"form",5),e.NdJ("ngSubmit",function(){return i.submitForm()}),e.TgZ(8,"div",6)(9,"div",7)(10,"div",8)(11,"app-homebase-map",9),e.NdJ("onClickedMap",function(a){return i.clickedMapChange(a)}),e.qZA()(),e.TgZ(12,"div",10)(13,"div",7)(14,"div",11)(15,"div",12)(16,"div",7)(17,"div",13)(18,"label",14),e._uU(19),e.qZA(),e.TgZ(20,"span",15),e._uU(21,"*"),e.qZA()(),e.TgZ(22,"div",13)(23,"span",16),e._UZ(24,"i",17),e.qZA()()(),e.TgZ(25,"input",18),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"locationName")}),e.qZA(),e.YNc(26,xs,2,1,"span",19),e.YNc(27,Os,2,1,"span",19),e.qZA()()(),e.TgZ(28,"div",7)(29,"div",11)(30,"div",12)(31,"div",7)(32,"div",13)(33,"label",14),e._uU(34),e.qZA(),e.TgZ(35,"span",15),e._uU(36,"*"),e.qZA()(),e.TgZ(37,"div",13)(38,"span",16),e._UZ(39,"i",17),e.qZA()()(),e.TgZ(40,"div",7)(41,"div")(42,"textarea",20),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"address")})("input",function(){return i.getRemainingText()}),e._uU(43," "),e.qZA(),e.TgZ(44,"span",21),e._uU(45),e.qZA(),e.YNc(46,Us,2,1,"span",19),e.YNc(47,Zs,2,1,"span",19),e.qZA(),e.TgZ(48,"div",22),e.YNc(49,ws,2,2,"button",23),e.qZA()()()()(),e.TgZ(50,"div",7)(51,"div",11)(52,"div",12)(53,"div",7)(54,"div",13)(55,"label",14),e._uU(56),e.qZA(),e.TgZ(57,"span",15),e._uU(58,"*"),e.qZA()(),e.TgZ(59,"div",13)(60,"span",16),e._UZ(61,"i",17),e.qZA()()(),e.TgZ(62,"input",24),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"latitude")}),e.qZA(),e.YNc(63,Ns,2,1,"span",19),e.YNc(64,Hs,2,1,"span",19),e.qZA()()(),e.TgZ(65,"div",7)(66,"div",11)(67,"div",12)(68,"div",7)(69,"div",13)(70,"label",14),e._uU(71),e.qZA(),e.TgZ(72,"span",15),e._uU(73,"*"),e.qZA()(),e.TgZ(74,"div",13)(75,"span",16),e._UZ(76,"i",17),e.qZA()()(),e.TgZ(77,"input",25),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"longitude")}),e.qZA(),e.YNc(78,Ds,2,1,"span",19),e.YNc(79,Fs,2,1,"span",19),e.qZA()()(),e.TgZ(80,"div",7)(81,"div",11)(82,"div",12)(83,"div",7)(84,"div",13)(85,"label",14),e._uU(86),e.qZA(),e.TgZ(87,"span",15),e._uU(88,"*"),e.qZA()(),e.TgZ(89,"div",13)(90,"span",16),e._UZ(91,"i",17),e.qZA()()(),e.TgZ(92,"select",26),e.YNc(93,Ms,2,2,"option",27),e.qZA()()()(),e.TgZ(94,"div",7)(95,"div",11),e.YNc(96,ks,5,1,"div",28),e.qZA()()()(),e.YNc(97,qs,7,2,"div",29),e.qZA()()(),e.TgZ(98,"div",30),e.YNc(99,Bs,4,4,"button",31),e.TgZ(100,"button",32),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(101),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.home_base),e.xp6(5),e.Q6J("formGroup",i.homebaseForm),e.xp6(4),e.Q6J("parent",i.homebaseForm)("homeBasePermission",i.homeBasePermission)("loginUser",i.loginUser),e.xp6(8),e.Oqu(i.locales.location_name),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.s9C("placeholder",i.locales.location_name),e.Q6J("ngClass",e.VKq(43,ze,(null==i.LocationName?null:i.LocationName.errors)&&(i.LocationName.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("locationName")),e.xp6(1),e.Q6J("ngIf",(null==i.LocationName||null==i.LocationName.errors?null:i.LocationName.errors.checkAppCharacter)&&(i.LocationName.touched||2===i.formType)),e.xp6(7),e.Oqu(i.locales.address),e.xp6(
15),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Tol(3===i.homeBasePermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)?"col-10":"col-12"),e.xp6(1),e.s9C("placeholder",i.locales.address),e.Q6J("ngClass",e.VKq(45,ze,(null==i.Address?null:i.Address.errors)&&(i.Address.touched||2===i.formType))),e.xp6(3),e.hij("",i.inputTextLength," / 150"),e.xp6(1),e.Q6J("ngIf",i.required("address")),e.xp6(1),e.Q6J("ngIf",(null==i.Address||null==i.Address.errors?null:i.Address.errors.checkNameAndAddress)&&(i.Address.touched||2===i.formType)),e.xp6(2),e.Q6J("ngIf",3===i.homeBasePermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(7),e.Oqu(i.locales.latitude),e.xp6(5),e.hYB("ngbTooltip","",i.locales.required,". ",i.locales.markMap,""),e.xp6(1),e.s9C("placeholder",i.locales.latitude),e.Q6J("ngClass",e.VKq(47,ze,(null==i.Latitude?null:i.Latitude.errors)&&(i.Latitude.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("latitude")),e.xp6(1),e.Q6J("ngIf",(null==i.Latitude||null==i.Latitude.errors?null:i.Latitude.errors.checkCoordinates)&&(i.Latitude.touched||2===i.formType)),e.xp6(7),e.Oqu(i.locales.longitude),e.xp6(5),e.hYB("ngbTooltip","",i.locales.required,". ",i.locales.markMap,""),e.xp6(1),e.s9C("placeholder",i.locales.longitude),e.Q6J("ngClass",e.VKq(49,ze,(null==i.Longitude?null:i.Longitude.errors)&&(i.Longitude.touched||2===i.formType))),e.xp6(1),e.Q6J("ngIf",i.required("longitude")),e.xp6(1),e.Q6J("ngIf",(null==i.Longitude||null==i.Longitude.errors?null:i.Longitude.errors.checkCoordinates)&&(i.Longitude.touched||2===i.formType)),e.xp6(7),e.Oqu(i.locales.timezone),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.timezones),e.xp6(3),e.Q6J("ngIf",i.showMainOfficeBit&&i.hasMainOffice),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("ngIf",3===i.homeBasePermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.mk,Q.sg,Q.O5,c._Y,c.YN,c.Kr,c.Fj,c.wV,c.Wl,c.EJ,c.JJ,c.JL,c.Q7,c.nD,c.sg,c.u,P._L,rt],styles:[".form-group[_ngcontent-%COMP%]{margin-bottom:.3rem}agm-map[_ngcontent-%COMP%]{height:300px}.button-map[_ngcontent-%COMP%]{float:right;width:50px}.textarea-width[_ngcontent-%COMP%]{width:100%}@media (min-width: 200px) and (max-width: 1024px){.textarea-width[_ngcontent-%COMP%]{width:215px}}"]})}return r})();class nt{static checkAssetVIN(l){let t=l.get("assetType").value,s=l.get("assetVin").value;return l?0===t&&17!==s.length?{checkAssetVIN:!0}:void 0:null}static checkAssetCharacterVIN(l){let t=l.get("assetType").value,s=l.get("assetVin").value;return l?0===t&&null===s.match(/^[0-9a-zA-Z]+$/)?{checkAssetCharacterVIN:!0}:void 0:null}static checkAssetRegState(l){let t=l.value;return l?0==t.trim().length||t.startsWith("--")?{checkAssetRegState:!0}:void 0:null}static checkPlate(l){let t=parseInt(l.get("assetType").value),s=l.get("assetPlate");return l?0===t&&s.dirty&&""===s.value?{checkPlate:!0}:void 0:null}}class Ct{static checkMacAddress(l){return l?""===l.value||/^([0-9A-F][0-9A-F]:){5}([0-9A-F][0-9A-F])$/g.test(l.value)?null:{invalidMacAddress:!0}:null}}var Ys=F(19356),$s=F(66139),Qs=F(74926);function Vs(r,l){if(1&r&&(e.TgZ(0,"span",57),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.selectValidCarrier," ")}}function Ws(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",5)(1,"div",12)(2,"div",20)(3,"carrier-selector",55),e.NdJ("onCarrierSelected",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onCarrierSelected(i))}),e.qZA(),e.YNc(4,Vs,2,1,"span",56),e.qZA()()()}if(2&r){const t=e.oxw();e.xp6(3),e.Q6J("carriers",t.moaCarriers)("selectedCarrier",t.selectedCarrierObj)("locales",t.locales)("selectorId","carrierSelectorAsset")("label",(null==t.locales?null:t.locales.carrier)||"Carrier")("showLabel",!0)("required",!0),e.xp6(1),e.Q6J("ngIf",t.errorCarrierSel)}}function zs(r,l){if(1&r&&(e.TgZ(0,"option",24),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.key),e.xp6(1),e.hij(" ",t.label," ")}}function js(r,l){if(1&r&&(e.TgZ(0,"option",24),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.HOSAssetSubTypeId),e.xp6(1),e.hij(" ",t.HOSAssetSubTypeName," ")}}function Gs(r,l){if(1&r&&(e.TgZ(0,"span",58),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.selectValidSubtype," ")}}function Ks(r,l){if(1&r&&(e.TgZ(0,"span",59),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.asset_number_validation)}}function Xs(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.assetNumberVal,"")}}function er(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.up10char)}}function tr(r,l){1&r&&(e.TgZ(0,"span",15),e._uU(1,"*"),e.qZA())}function ir(r,l){if(1&r&&(e.TgZ(0,"span",61),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.asset_vin_validation)}}function sr(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.tractor_vin_validation)}}function rr(r,l){if(1&r&&(e.TgZ(0,"span",61),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.check_alfaNumeric)}}function or(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.appcharactererror)}}function nr(r,l){if(1&r&&(e.TgZ(0,"option",24),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.code),e.xp6(1),e.hij(" ",t.label," ")}}function ar(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.appcharactererror)}}function lr(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.up10char)}}function cr(r,l){if(1&r&&(e.TgZ(0,"option",62),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.selectState)}}function dr(r,l){if(1&r&&(e.TgZ(0,"option",24),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.value),e.xp6(1),e.hij(" ",t.label," ")}}function mr(r,l){if(1&r&&(e.TgZ(0,"optgroup",63),e.YNc(1,dr,2,2,"option",19),e.qZA()),2&r){const t=l.$implicit;e.s9C("label",t.name),e.xp6(1),e.Q6J("ngForOf",t.states)}}function ur(r,l){if(1&r&&(e.TgZ(0,"span",58),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.state_validation," ")}}function hr(r,l){if(1&r&&(e.TgZ(0,"option",24),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.HOSHomeBaseId),e.xp6(1),e.Oqu(t.Name)}}function pr(r,l){if(1&r&&(e.TgZ(0,"option",24),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.CustomDVIRtemplateId),e.xp6(1),e.Oqu(t.CustomDVIRtemplateName)}}function fr(r,l){if(1&r&&(e.TgZ(0,"div",64)(1,"div",20)(2,"div",47),e._UZ(3,"input",65),e.TgZ(4,"label",66),e._uU(5),e.qZA()()()()),2&r){const t=e.oxw();e.xp6(5),e.Oqu(t.locales.customDVIRRestricted)}}function gr(r,l){1&r&&(e.TgZ(0,"span",15),e._uU(1,"*"),e.qZA())}function vr(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.ecmid_validation)}}function _r(r,l){if(1&r&&(e.TgZ(0,"span",60),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.requiredECMText," ")}}function Sr(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",5)(1,"div",12)(2,"div",20)(3,"div",5)(4,"div",14)(5,"label",67),e._uU(6),e.qZA(),e.YNc(7,gr,2,0,"span",29),e.qZA(),e.TgZ(8,"div",14)(9,"span",16),e._UZ(10,"i",17),e.qZA()()(),e.TgZ(11,"input",68),e.NdJ("onChange",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.checkECMID(i))}),e.qZA(),e.YNc(12,vr,2,1,"span",28),e.YNc(13,_r,2,1,"span",28),e.qZA()(),e.TgZ(14,"div",12)(15,"div",20)(16,"div",5)(17,"div",33)(18,"label",42),e._uU(19),e.qZA()(),e.TgZ(20,"div",34)(21,"span",16),e._UZ(22,"i",17),e.qZA()()(),e.TgZ(23,"input",69),e.NdJ("keypress",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.lettersAndNumbers(i))})("change",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onValueAdd(i.target.value,"additionalECMId"))}),e.qZA()()()()}if(2&r){const t=e.oxw();
1e.xp6(6),e.Oqu(t.locales.ecm_id),e.xp6(1),e.Q6J("ngIf",t.requiredECM),e.xp6(3),e.cQ8("ngbTooltip","",t.locales.requiredECM," ",t.locales.formatECM," ",t.locales.deviceMac,"."),e.xp6(1),e.ekj("is-invalid",(null==t.AssetECMID?null:t.AssetECMID.errors)&&(t.AssetECMID.touched||2===t.formType)||""===t.AssetECMID.value&&t.requiredECM&&(t.AssetECMID.touched||2===t.formType)),e.s9C("placeholder",t.placeholder),e.Q6J("required",t.requiredECM),e.xp6(1),e.Q6J("ngIf",(null==t.AssetECMID?null:t.AssetECMID.errors)&&(t.AssetECMID.touched||2===t.formType)),e.xp6(1),e.Q6J("ngIf",(t.AssetECMID.touched||2===t.formType)&&""===t.AssetECMID.value&&t.requiredECM),e.xp6(6),e.Oqu(t.locales.additional_ecm_id),e.xp6(3),e.s9C("ngbTooltip",t.locales.notRequired),e.xp6(1),e.s9C("placeholder",t.locales.additional_ecm_id)}}function br(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",70)(1,"h5"),e._uU(2,"Warning!"),e.qZA(),e.TgZ(3,"div")(4,"p"),e._uU(5,"This change may impact the upcoming billing report and invoice."),e.qZA()(),e.TgZ(6,"div")(7,"button",71),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.proceedActiveChange())}),e._uU(8,"Proceed"),e.qZA(),e.TgZ(9,"button",72),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.cancelActiveChange())}),e._uU(10,"Close"),e.qZA()()()}}function Cr(r,l){if(1&r&&(e.TgZ(0,"div",73)(1,"button",74),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",75),e._uU(5),e.qZA(),e._UZ(6,"div",76),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.Q6J("innerHTML",t.formState.message,e.oJD)}}function Tr(r,l){1&r&&e._UZ(0,"span",80)}function yr(r,l){if(1&r&&(e.TgZ(0,"span",81),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.loading)}}function Ar(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",77),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.submitForm())}),e.YNc(1,Tr,1,0,"span",78),e.YNc(2,yr,2,1,"span",79),e._uU(3),e.qZA()}if(2&r){const t=e.oxw();e.Q6J("disabled",t.disabledSubmitButton()),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.Q6J("ngIf",t.formState.loading),e.xp6(1),e.hij(" ",t.locales.save," ")}}let Tt=(()=>{class r{constructor(t,s,i,o,a,d,m,v,Z){this.activeModal=t,this.fb=s,this.utilService=i,this.changeDetectorRef=o,this.hosService=a,this.authService=d,this.eventBus=m,this.dvirManageService=v,this.carrierService=Z,this.onSubmit=new e.vpe,this.placeholder="##:##:##:##:##:##",this.tractorProperties=new Ys.V,this.selectedAsset=0,this.assetType=[],this.fuelType=[],this.GVWRList=[],this.typeTractor=[],this.isLocal=!1,this.requiredHomeBase=!1,this.validCharsForTractorVIN="1234567890ABCDEFGHJKLMNPRSTUVWXYZ",this.selectChanged=!1,this.showProperties=!1,this.responsePropertiesOK=!1,this.assetsSubtypes=[],this.allAssetsSubtypes=[],this.customDVIRTemplates=[],this.errorState=!1,this.errorSubtype=!1,this.showActiveWarning=!1,this.moaCarriers=[],this.errorCarrierSel=!1,this.selectedCarrierObj=null,this.assetValidator={assetNumberError:!1,assetVinError:!1,assetStateError:!1,Message:"",status:"invalid"},this.assetFormSub=new V.w}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close(),this.form.valueChanges&&(1==this.AssetType.value?(this.requiredECM=!1,this.showProperties=!1,this.AssetECMID.setErrors(null),this.AssetVin.setValidators(null)):(this.showProperties=!0,this.AssetVin.setValidators([c.kI.required,c.kI.minLength(17)])),""===this.AssetPlate?.value&&this.AssetPlate?.setErrors(null),""===this.AssetVin?.value&&1==+this.AssetType?.value&&this.AssetVin?.setErrors(null),this.AssetVin?.updateValueAndValidity()),this.hosService.moaForUser?.length>0&&(this.requiredECM=!1)}ngOnDestroy(){$(".select2-container").removeClass("select2-container--open"),this.homebasesList.find(i=>0===i.HOSHomeBaseId)&&this.homebasesList.shift(),this.moaCarriers?.length>0&&-1===this.moaCarriers[0]?.HOSClientId&&this.moaCarriers.shift(),$("#assetType").remove(),$("#assetRegState").remove(),$("#homebase").remove(),$("#assetSubtype").remove(),$("#customDVIRTemplate").remove(),this.assetFormSub.unsubscribe()}getAssetModelPermission(){this.assetPermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>7===s)?7:8}
1getHomebases(){if(this.hosService.homeBasesAdmin&&this.hosService.homeBasesAdmin.length>0){if(this.homebasesList=this.hosService.homeBasesAdmin,this.requiredHomeBase=!0,0===this.asset.HOSHomeBaseId||!this.asset.HOSHomeBaseId){let t=this.homebasesList.find(s=>1===s.DefaultHome);this.mainOfficeId=t?t.HOSHomeBaseId:this.homebasesList[0].HOSHomeBaseId,this.HomeBase.setValue(this.mainOfficeId)}}else this.homebasesList=[],this.homebasesList.push({HOSHomeBaseId:0,Name:this.locales.noHomeBase}),this.requiredHomeBase=!1,this.formState={loading:!1,submited:!1,errors:!0,message:this.hosService.moaForUser?.length>0?this.locales.noHomebaseCreatedMOA:this.locales.noHomebaseCreated},this.HomeBase.setValue(this.homebasesList[0].HOSHomeBaseId)}ngAfterViewChecked(){this.changeDetectorRef.detectChanges()}ngAfterViewInit(){0==+this.AssetType.value?$("#tractorType").show():$("#tractorType").hide(),$("#assetType").select2(),$("#assetRegState").select2(),$("#homebase").select2(),$("#assetSubtype").select2(),$("#customDVIRTemplate").select2(),$("#FuelTypePrimary").select2(),$("#assetType").on("change",t=>{this.form.markAsDirty(),this.AssetSubtype.setValue(-1),this.CustomDVIRTemplate.setValue(0),this.IsCustomtemplateRestricted.setValue(0),this.customDVIRTemplates=[],this.AssetType.setValue(t.target.value),0==t.target.value?(this.showECMInput=!0,this.requiredECM=1===this.currentCarrier?.ForceECMLinkConnection,$("#tractorType").show()):(this.showECMInput=!1,this.requiredECM=!1,$("#tractorType").hide()),this.assetsSubtypes=this.allAssetsSubtypes.filter(s=>s.HOSAssetTypeId===+t.target.value||-1===s.HOSAssetTypeId)}),$("#homebase").on("change",t=>{this.HomeBase.setValue(t.target.value),this.form.markAsDirty()}),$("#customDVIRTemplate").on("change",t=>{this.CustomDVIRTemplate.setValue(t.target.value),this.IsCustomtemplateRestricted.setValue(0),this.form.markAsDirty()}),$("#assetRegState").on("change",t=>{this.form.markAsDirty(),this.form.get("assetRegState").setValue(t.target.value),t.target.value===this.locales.selectState?(this.errorState=!0,setTimeout(()=>{$("#assetRegState").select2({containerCssClass:"invalid-color"})},50)):(this.errorState=!1,setTimeout(()=>{$("#assetRegState").select2()},50))}),$("#assetSubtype").on("change",t=>{this.form.markAsDirty(),this.AssetSubtype.setValue(t.target.value),this.CustomDVIRTemplate.setValue(0),this.IsCustomtemplateRestricted.setValue(0),-1!=+t.target.value?(this.errorSubtype=!1,setTimeout(()=>{$("#assetSubtype").select2()},50),this.getTemplatesForAsset()):(this.errorSubtype=!0,setTimeout(()=>{$("#assetSubtype").select2({containerCssClass:"invalid-color"})},50),this.customDVIRTemplates=[])}),$("#FuelTypePrimary").on("change",t=>{this.form.markAsDirty(),this.FuelTypePrimary.setValue(t.target.value)})}getYear(){return this.utilService.getToday().getFullYear()}keyPressNumbers(t){var s=t.which?t.which:t.keyCode;return!(s<48||s>57)||(t.preventDefault(),!1)}ngOnInit(){this.loginUser=this.hosService.loginUser,this.moaForUser=this.hosService.moaForUser,this.assetsSubtypes=[...this.hosService.assetsSubtypes],this.allAssetsSubtypes=[...this.hosService.assetsSubtypes],this.loginUser&&this.getAssetModelPermission(),this.stateList=this.utilService.licenseState,this.fuelType=this.utilService.fuelTypeList,this.GVWRList=this.utilService.GVWRList,this.typeTractor=this.utilService.typeTractor,this.form=this.fb.group({assetType:[this.asset.Type],assetSubtype:[this.asset.HOSAssetSubTypeId],assetNumber:[this.asset.Number,[c.kI.required,c.kI.minLength(1),c.kI.maxLength(10),u.s.checkAssetNumber]],assetVin:[this.asset.VIN,[c.kI.required,c.kI.maxLength(17),u.s.checkAppCharacters]],assetPlate:[this.asset.Plate],assetRegState:[this.asset.RegistrationState,[nt.checkAssetRegState]],homebase:[this.asset.HOSHomeBaseId],customDVIRTemplate:[this.asset.DefaultCustomDVIRtemplateId],assetDescription:[this.asset.Description],assetEcmid:[this.asset.ECMId,[Ct.checkMacAddress]],additionalECMId:[this.asset.AdditionalECMId],assetActive:[!!this.asset.Active],isCustomDVIRtemplateRestricted:[this.asset.IsCustomDVIRtemplateRestricted],FuelTypePrimary:[this.tractorProperties.FuelTypePrimary,[c.kI.required]],c
1arrier:[this.asset.HOSClientId]},{validators:[nt.checkAssetVIN,nt.checkAssetCharacterVIN]}),""===this.asset.RegistrationState&&this.State.setValue(this.locales.selectState),this.assetType=[{key:0,label:this.locales.tractor},{key:1,label:this.locales.trailer}];const{CountMode:t=0}=this.authService?.appReseller;this.originalActiveValue=this.form.get("assetActive").value;const s=localStorage.getItem("statusChangeConfirmed")||"no";this.form.get("assetActive").valueChanges.subscribe(o=>{this.showActiveWarning=this.originalActiveValue!==o&&(1===t||2===t)&&"yes"!==s}),this.AssetFormType.valueChanges.subscribe(o=>{const a=[Ct.checkMacAddress];0===parseInt(o)&&(this.form.removeControl("assetEcmid"),this.form.addControl("assetEcmid",new c.p4(this.asset.ECMId,a)),this.showProperties=!0),1===parseInt(o)&&(this.form.removeControl("assetEcmid"),this.form.addControl("assetEcmid",new c.p4(this.asset.ECMId)),this.showProperties=!1),this.form.updateValueAndValidity()}),this.showECMInput=1!=this.asset.Type,this.getHomebases(),8===this.assetPermission&&this.loginUser&&6!==this.loginUser.HOSUserTypeId&&7!==this.loginUser.HOSUserTypeId&&this.form.disable(),1===this.formType?(this.AssetSubtype.setValue(-1),this.assetsSubtypes=this.assetsSubtypes.filter(o=>0===o.HOSAssetTypeId||-1===o.HOSAssetTypeId),this.CustomDVIRTemplate.setValue(0)):(this.getTemplatesForAsset(),this.assetsSubtypes=this.assetsSubtypes.filter(o=>o.HOSAssetTypeId===this.asset.Type||-1===o.HOSAssetTypeId),this.asset.DefaultCustomDVIRtemplateId<1&&this.CustomDVIRTemplate.setValue(0));const i=this.fuelType.find(o=>o.code===this.asset.FuelTypeId);if(this.FuelTypePrimary.setValue(i?i.code:this.fuelType[this.fuelType.length-1].code),9===this.loginUser?.HOSUserTypeId||this.moaForUser?.length>0){this.moaCarriers=this.hosService.moaForUser[0].HOSClients,10===this.loginUser?.HOSUserTypeId&&this.loginUser?.HOSClients?.length>0&&(this.moaCarriers=this.hosService.carriers);let o=this.carrierService.getPristineCarrier();o.Name=` -- ${this.locales.select_carrier} -- `;const a=this.moaCarriers.find(d=>-1===d.HOSClientId);if(1===this.formType){void 0===a&&this.moaCarriers.unshift(o);const d=this.currentCarrier?.HOSClientId>0?this.moaCarriers.find(m=>m.HOSClientId===this.currentCarrier.HOSClientId):null;d?(this.Carrier.setValue(d.HOSClientId),this.selectedCarrierObj=d):(this.Carrier.setValue(-1),this.selectedCarrierObj=o)}else{a&&this.moaCarriers.shift();const d=this.moaCarriers.find(m=>m.HOSClientId===this.asset.HOSClientId);d?(this.selectedCarrierObj=d,this.Carrier.setValue(d.HOSClientId)):this.asset.HOSClientId>0?(this.selectedCarrierObj={HOSClientId:0},this.Carrier.setValue(this.asset.HOSClientId),this.hosService.getCarrierByIdCached(this.asset.HOSClientId).subscribe(m=>{m&&m.HOSClientId>0&&(this.moaCarriers.find(v=>v.HOSClientId===m.HOSClientId)||this.moaCarriers.push(m),this.selectedCarrierObj=m)})):(this.selectedCarrierObj={HOSClientId:0},this.Carrier.setValue(0))}}}onCarrierSelected(t){this.selectedCarrierObj=t,this.form.get("carrier").setValue(t?t.HOSClientId:-1),this.form.markAsDirty(),this.errorCarrierSel=!t||-1===t.HOSClientId}get Carrier(){return this.form.get("carrier")}requiredCarrier(){return+this.Carrier.value>0}findHomeBase(t){return this.homebasesList.find(s=>
1s.HOSHomeBaseId===t)}checkLettersAndNumbers(t){return!this.utilService.isLettersAndNumbers(t)}checkLettersAndNumbersChar(t){return!this.utilService.isLettersAndNumbersChar(t)}checkECMID(t){this.AssetECMID.setValue(t),this.form.markAsDirty()}checkState(){return this.State.value===this.locales.selectState&&this.State.touched}get AssetECMID(){return this.form.get("assetEcmid")}get AssetFormType(){return this.form.get("assetType")}get AssetNumber(){return this.form.get("assetNumber")}get State(){return this.form.get("assetRegState")}get AssetVin(){return this.form.get("assetVin")}get AssetPlate(){return this.form.get("assetPlate")}get AssetSubtype(){return this.form.get("assetSubtype")}get FuelTypePrimary(){return this.form.get("FuelTypePrimary")}get AssetRegState(){return this.form.get("assetRegState")}get HomeBase(){return this.form.get("homebase")}get CustomDVIRTemplate(){return this.form.get("customDVIRTemplate")}get IsCustomtemplateRestricted(){return this.form.get("isCustomDVIRtemplateRestricted")}checkActiveAsset(){let t=this.form.get("assetActive").value;return this.asset.AssetId>0&&0===this.asset.Active&&!1===t}get AssetType(){return this.form.get("assetType")}required(t){return this.form.get(`${t}`).hasError("required")&&(this.form.get(`${t}`).touched||2===this.formType)}validateTractorVIN(t){if(1==+this.AssetType?.value&&""===this.AssetVin?.value)return!0;for(var s=0;s<t.length;s++)if(-1==this.validCharsForTractorVIN.indexOf(t.charAt(s)))return!1;return!0}onValueAdd(t,s){let i=t.trim();this.form.get(`${s}`).setValue(i)}findAssetType(t){return this.assetType.find(s=>s.key===t)}findAssetSubtype(t){return this.assetsSubtypes.find(s=>s.HOSAssetSubTypeId===t)}submitForm(){let t=this.form.value,s="";this.form.invalid&&(s=this.locales.invalidForm+"<br/>"),(this.checkLettersAndNumbersChar(t.assetNumber)||(0==+this.AssetType.value||""!==this.AssetVin.value)&&this.checkLettersAndNumbers(t.assetVin)||""!==t.assetPlate&&this.checkLettersAndNumbers(t.assetPlate))&&(s=this.locales.invalidValue+"<br/>"),(0==+this.AssetType.value||""!==this.AssetVin.value)&&!this.checkVINNumber()&&(s+=this.locales.charVIN+"<br/>"),this.findAssetType(+t.assetType)||(s+=this.locales.invalidAssetType+"<br/>"),this.findAssetSubtype(+t.assetSubtype)||(s+=this.locales.invalidSubtype+"<br/>"),this.utilService.findState(t.assetRegState)||(s+=this.locales.invalidState+"<br/>"),this.findHomeBase(+t.homebase)||(s+=this.locales.invalidHomeBase+"<br/>"),0==+t.homebase&&(s+=this.locales.homeBaseRequired+"<br/>"),!this.requiredCarrier()&&this.moaForUser?.length>0&&(s+=this.locales.selectValidCarrier+"<br/>"),""!==s?this.formState={loading:!1,submited:!1,errors:!0,message:s}:this.onSubmit.emit({formdata:this.form.value})}lettersAndNumbers(t){return this.utilService.lettersAndNumbers(t)}checkVINNumber(){return 1==+this.AssetType?.value&&""===this.AssetVin?.value||!!this.AssetVin.value.match(/^[0-9a-zA-Z]+$/)}getTemplatesForAsset(){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.dvirManageService.getCustomDVIRTemplate({HOSAssetSubTypeId:+this.AssetSubtype.value,HOSAssetTypeId:+this.AssetType.value,HOSClientId:this.hosService.moaForUser?.length>0?0:this.currentCarrier.HOSClientId,HOSAccountId:this.hosService.moaForUser?.length>0?this.hosService.moaForUser[0].HOSAccountId:0,Active:1,Lang:this.authService.appCredentials.lang}).subscribe(s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:i,data:o}=s.d;1===i?(this.customDVIRTemplates=[...o],1===this.formType&&this.IsCustomtemplateRestricted.setValue(0)):this.customDVIRTemplates=[]},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.customDVIRTemplates=[]})}disabledSubmitButton(){return this.form.invalid||!this.form.dirty||this.formState.loading||this.showActiveWarning||this.asset.AssetId>0&&0===this.asset.Active&&(!1===this.form.get("assetActive").value||0===this.form.get("assetActive").value)||(0==+this.AssetType.value||""!==this.AssetVin.value)&&!this.checkVINNumber()||0==+this.form.get("homebase").value||-1==+this.AssetSubtype?.value||this.moaForUser?.length>0&&!this.requiredCarrier()}proceedActiveChange(){localStorage.setItem("statusChangeConfirmed","yes"),this.showActiveWarning=!1,this.originalActiveValue=this.form.get("assetActive").value}cancelActiveChange(){localStorage.setItem("statusChangeConfirmed","yes"),this.form.get("assetActive").setValue(this.originalActiveValue),this.showActiveWarning=!1}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(c.QS),e.Y36(b.f),e.Y36(e.sBO),e.Y36(y.T),e.Y36(p.e),e.Y36(n.Yd),e.Y36($s.Y),e.Y36(I.V))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-asset-form"]],inputs:{asset:"asset",locales:"locales",formState:"formState",isDisabled:"isDisabled",requiredECM:"requiredECM",currentCarrier:"currentCarrier",formType:"formType"},outputs:{onSubmit:"onSubmit"},decls:170,vars:70,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],[1,"row"],[1,"col-sm-12"],["role","form","novalidate","",3,"formGroup"],[1,"card-body"],[1,"card","border-dark","mb-3",2,"max-width","100%","width","100%"],[1,"card-body","text-dark","my_card-body"],["class","row",4,"ngIf"],[1,"col-md-6"],["ngbAutofocus","",1,"form-group"],[1,"col-6"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["name","Type","id","assetType","formControlName","assetType","required","",1,"form-control",2,"width","100%"],[3,"value",4,"ngFor","ngForOf"],[1,"form-group"],[1,"col-7"],[1,"col-5"],["name","Type","id","assetSubtype","formControlName","assetSubtype","required","",1,"form-control",2,"width","100%"],[3,"value"],["class","invali
1d-select",4,"ngIf"],["type","text","id","assetNumber","name","Number","formControlName","assetNumber","autocomplete","off","maxlength","10","oninput","this.value = this.value.toUpperCase()","required","",1,"form-control",3,"placeholder","change"],["id","number-error","class","error invalid-feedback",4,"ngIf"],["class","error invalid-feedback",4,"ngIf"],["class","required-asterisk",4,"ngIf"],["type","text","id","assetVIN","name","VIN","formControlName","assetVin","maxlength","17","oninput","this.value = this.value.toUpperCase()","autocomplete","off",1,"form-control",3,"placeholder","keypress"],["id","vin-error","class","error invalid-feedback",4,"ngIf"],["id","tractorType",1,"col-md-6"],[1,"col-8"],[1,"col-4"],["name","FuelTypePrimary","id","FuelTypePrimary","formControlName","FuelTypePrimary","required","",1,"form-control",2,"width","100%"],["type","text","autocomplete","off","id","assetPlate","name","Plate","formControlName","assetPlate","maxlength","10","oninput","this.value = this.value.toUpperCase()","required","",1,"form-control",3,"placeholder","keypress","change"],["name","RegistrationState","formControlName","assetRegState","id","assetRegState","required","",1,"form-control",2,"width","100%"],["selected","true",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],["for","homebase"],["formControlName","homebase","id","homebase",1,"form-control",2,"width","100%"],["for","customDVIRTemplate"],["formControlName","customDVIRTemplate","id","customDVIRTemplate",1,"form-control",2,"width","100%"],["class","col-md-6 margin-input",4,"ngIf"],[1,"col-md-12"],["rows","3","description","","name","Description","formControlName","assetDescription",1,"form-control",3,"placeholder","change"],[1,"form-check"],["type","checkbox","formControlName","assetActive",1,"form-check-input"],["for","assetActive",1,"form-check-label"],["class","alert alert-secondary alert-dismissible",4,"ngIf"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"modal-footer"],["type","button","class","btn btn-primary",3,"disabled","click",4,"ngIf"],["type","button",1,"btn","btn-outline-dark",3,"click"],[3,"carriers","selectedCarrier","locales","selectorId","label","showLabel","required","onCarrierSelected"],["class","error invalid-feedback d-block",4,"ngIf"],[1,"error","invalid-feedback","d-block"],[1,"invalid-select"],["id","number-error",1,"error","invalid-feedback"],[1,"error","invalid-feedback"],["id","vin-error",1,"error","invalid-feedback"],["selected","true"],[3,"label"],[1,"col-md-6","margin-input"],["type","checkbox","formControlName","isCustomDVIRtemplateRestricted",1,"form-check-input"],["for","isCustomDVIRtemplateRestricted",1,"form-check-label"],["for","ecmidentified"],["type","text","autocomplete","off","id","ecmidentified","name","ECMId","data-inputmask","'alias':'mac'","data-mask","","ecmid","","im-insert","true","formControlName","assetEcmid",1,"form-control",3,"required","placeholder","onChange"],["type","text","id","addecmidentified","name","AdditionalECMId","autocomplete","off","formControlName","additionalECMId",1,"form-control",3,"placeholder","keypress","change"],[1,"alert","alert-secondary","alert-dismissible"],[1,"btn","btn-outline-light","mr-2",3,"click"],["type","button",1,"btn","btn-outline-light",3,"click"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"],[3,"innerHTML"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["class","spinner-border spinner-border-sm","role","status","aria-hidden","true",4,"ngIf"],["class","sr-only",4,"ngIf"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"sr-only"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"div",5)(8,"div",6)(9,"form",7)(10,"div",8)(11,"div",9)(12,"div",10),e.YNc(13,Ws,5,8,"div",11),e.TgZ(14,"div",5)(15,"div",12)(16,"div",13)(17,"div",5)(18,"div",14)(19,"label"),e._uU(20),e.qZA(),e.TgZ(21,"span",15),e._uU(22,"*"),e.qZA()(),e.TgZ(23,"div",14)(24,"span",16),e._UZ(25,"i",17),e.qZA()()(),e.TgZ(26,"select",18),e.YNc(27,zs,2,2,"option",19),e.qZA()()(),e.TgZ(28,"div",12)(29,"div",20)(30,"div",5)(31,"div",21)(32,"label"),e._uU(33),e.qZA(),e.TgZ(34,"span",15),e._uU(35,"*"),e.qZA()(),e.TgZ(36,"div",22)(37,"span",16),e._UZ(38,"i",17),e.qZA()()(),e.TgZ(39,"select",23)(40,"option",24),e._uU(41),e.qZA(),e.YNc(42,js,2,2,"option",19),e.qZA(),e.YNc(43,Gs,2,1,"span",25),e.qZA()()(),e.TgZ(44,"div",5)(45,"div",12)(46,"div",20)(47,"div",5)(48,"div",14)(49,"label"),e._uU(50),e.qZA(),e.TgZ(51,"span",15),e._uU(52,"*"),e.qZA()(),e.TgZ(53,"div",14)(54,"span",16),e._UZ(55,"i",17),e.qZA()()(),e.TgZ(56,"input",26),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"assetNumber")}),e.qZA(),e.YNc(57,Ks,2,1,"span",27),e.YNc(58,Xs,2,1,"span",28),e.YNc(59,er,2,1,"span",28),e.qZA()(),e.TgZ(60,"div",12)(61,"div",20)(62,"div",5)(63,"div",14)(64,"label"),e._uU(65),e.qZA(),e.YNc(66,tr,2,0,"span",29),e.qZA(),e.TgZ(67,"div",14)(68,"span",16),e._UZ(69,"i",17),e.qZA()()(),e.TgZ(70,"input",30),e.NdJ("keypress",function(a){return i.lettersAndNumbers(a)}),e.qZA(),e.YNc(71,ir,2,1,"span",31),e.YNc(72,sr,2,1,"span",28),e.YNc(73,rr,2,1,"span",31),e.YNc(74,or,2,1,"span",28),e.qZA()()(),e.TgZ(75,"div",5)(76,"div",32)(77,"div",20)(78,"div",5)(79,"div",33)(80,"label"),e._uU(81),e.qZA(),e.TgZ(82,"span",15),e._uU(83,"*"),e.qZA()(),e.TgZ(84,"div",34)(85,"span",16),e._UZ(86,"i",17),e.qZA()()(),e.TgZ(87,"select",35),e.YNc(88,nr,2,2,"option",19),e.qZA()()(),e.TgZ(89,"div",12)(90,"div",20)(91,"div",5)(92,"div",14)(93,"label"),e._uU(94),e.qZA()(),e.TgZ(95,"div",14)(96,"span",16),e._UZ(97,"i",17),e.qZA()()(),e.TgZ(98,"input",36),e.NdJ("keypress",function(a){return i.lettersAndNumbers(a)})("change",function(a){return i.onValueAdd(a.target.value,"assetPlate")}),e.qZA(),e.YNc(99,ar,2,1,"span",28),e.YNc(100,lr,2,1,"span",28),e.qZA()()(),e.TgZ(101,"div",5)(102,"div",12)(103,"div",20)(104,"div",5)(105,"div",33)(106,"label"),e._uU(107),e.qZA(),e.TgZ(108,"span",15),e._uU(109,"*"),e.qZA()(),e.TgZ(110,"div",34)(111,"span",16),e._UZ(112,"i",17),e.qZA()()(),e.TgZ(113,"select",37),e.YNc(114,cr,2,1,"option",38),e.YNc(115,mr,2,2,"optgroup",39),e.qZA(),e.YNc(116,ur,2,1,"span",25),e.qZA()(),e.TgZ(117,"div",12)(118,"div",20)(119,"div",5)(120,"div",14)(121,"label",40),e._uU(122),e.qZA(),e.TgZ(123,"span",15),e._uU(124,"*"),e.qZA()(),e.TgZ(125,"div",14)(126,"span",16),e._UZ(127,"i",17),e.qZA()()(),e.TgZ(128,"select",41),e.YNc(129,hr,2,2,"option",19),e.qZA()()()(),e.TgZ(130,"div",5)(131,"div",12)(132,"div",20)(133,"div",5)(134,"div",33)(135,"label",42),e._uU(136),e.qZA()(),e.TgZ(137,"div",34)(138,"span",16),e._UZ(139,"i",17),e.qZA()()(),e.TgZ(140,"select",43)(141,"option",24),e._uU(142),e.qZA(),e.YNc(143,pr,2,2,"option",19),e.qZA()()(),e.YNc(144,fr,6,1,"div",44),e.qZA(),e.TgZ(145,"div",5)(146,"div",45)(147,"div",20)(148,"div",5)(149,"div",14)(150,"label",42),e._uU(151),e.qZA()(),e.TgZ(152,"div",14)(153,"span",16),e._UZ(154,"i",17),e.qZA()()(),e.TgZ(155,"textarea",46),e.NdJ("change",function(a){return i.onValueAdd(a.target.value,"assetDescription")}),e.qZA()()()(),e.YNc(156,Sr,24,14,"div",11),e.TgZ(157,"div",5)(158,"div",45)(159,"div",20)(160,"div",47),e._UZ(161,"input",48),e.TgZ(162,"label",49),e._uU(163),e.qZA()()()()(),e.YNc(164,br,11,0,"div",50),e.qZA()()()(),e.YNc(165,Cr,7,2,"div",51),e.qZA()()(),e.TgZ(166,"div",52),e.YNc(167,Ar,4,4,"button",53),e.TgZ(168,"button",54),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(169),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.asset),e.xp6(7),e.Q6J("formGroup",i.form),e.xp6(4),e.Q6J("ngIf",9===(null==i.loginUser?null:i.loginUser.HOSUserTypeId)||(null==i.moaForUser?null:i.moaForUser.length)>0),e.xp6(7),e.Oqu(i.locales.asset_type),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.assetType),e.xp6(6),e.Oqu(i.locales.assetSubtype),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("value",-1),e.xp6(1),e.Oqu(i.locales.selectAssetSubtype),e.xp6(1),e.Q6J("ngForOf",i.assetsSubtypes),e.xp6(1),e.Q6J("ngIf",i.errorSubtype),e.xp6(7),e.Oqu(i.locales.number),e.xp6(5),e.cQ8("ngbTooltip","",i.locales.required,". ",i.locales.up10char," ",i.locales.assetNumberVal,""),e.xp6(1),e.ekj("is-invalid",(null==i.AssetNumber?null:i.AssetNumber.errors)&&(i.AssetNumber.touched||2===i.formType)),e.s9C("placeholder",i.locales.number),e.xp6(1),e.Q6J("ngIf",i.required("assetNumber")),e.xp6(1),e.Q6J("ngIf",null==i.AssetNumber?null:i.AssetNumber.hasError("checkAssetNumber")),e.xp6(1),e.Q6J("ngIf",(null==i.AssetNumber||null==i.AssetNumber.value?null:i.AssetNumber.value.length)>10&&(i.AssetNumber.touched||2===i.formType)),e.xp6(6),e.Oqu(i.locales.vin),e.xp6(1),e.Q6J("ngIf",0==+i.AssetType.value),e.xp6(3),e.FAE("ngbTooltip","",1==+i.AssetType.value?i.locales.notRequired:i.locales.required+"."," ",i.locales.tractor_vin_validation," ",i.locales.charVIN," ",i.locales.onlyAlfanumeric,""),e.xp6(1),e.ekj("is-invalid",(0==+i.AssetType.value||""!==i.AssetVin.value)&&((null==i.AssetVin?null:i.AssetVin.errors)||i.checkLettersAndNumbers(i.AssetVin.value)||!i.checkVINNumber())&&(i.AssetVin.touched||2===i.formType)),e.s9C("placeholder",i.locales.vin),e.xp6(1),e.Q6J("ngIf",i.required("assetVin")&&0==+i.AssetType.value),e.xp6(1),e.Q6J("ngIf",0==+i.AssetType.value&&i.form.get("assetVin").value.length<17&&(i.AssetVin.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",i.form.hasError("checkAssetCharacterVIN")&&(i.form.get("assetVin").touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(0==+i.AssetType.value||""!==i.AssetVin.value)&&i.checkLettersAndNumbers(i.AssetVin.value)&&(i.AssetVin.touched||2===i.formType)),e.xp6(7),e.Oqu(i.locales.fuelTypePrimary),e.xp6(
15),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.fuelType),e.xp6(6),e.Oqu(i.locales.plate),e.xp6(3),e.hYB("ngbTooltip","",i.locales.notRequired," ",i.locales.onlyAlfanumeric,""),e.xp6(1),e.ekj("is-invalid",(""!==i.AssetPlate.value&&i.checkLettersAndNumbers(i.AssetPlate.value)||(null==i.AssetPlate.value?null:i.AssetPlate.value.length)>10)&&(i.AssetPlate.touched||2===i.formType)),e.s9C("placeholder",i.locales.plate),e.xp6(1),e.Q6J("ngIf",""!==i.AssetPlate.value&&i.checkLettersAndNumbers(i.AssetPlate.value)&&(i.AssetPlate.touched||2===i.formType)),e.xp6(1),e.Q6J("ngIf",(null==i.AssetPlate.value?null:i.AssetPlate.value.length)>10&&(i.AssetPlate.touched||2===i.formType)),e.xp6(7),e.Oqu(i.locales.registration_state),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngIf",""===i.asset.RegistrationState),e.xp6(1),e.Q6J("ngForOf",i.stateList),e.xp6(1),e.Q6J("ngIf",i.errorState),e.xp6(6),e.Oqu(i.locales.home_base),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.homebasesList),e.xp6(7),e.Oqu(i.locales.customDVIRTemplate),e.xp6(3),e.s9C("ngbTooltip",i.locales.notRequired),e.xp6(2),e.Q6J("value",0),e.xp6(1),e.Oqu(i.locales.selectCustomDVIRTemplate),e.xp6(1),e.Q6J("ngForOf",i.customDVIRTemplates),e.xp6(1),e.Q6J("ngIf",(null==i.CustomDVIRTemplate?null:i.CustomDVIRTemplate.value)>0),e.xp6(7),e.Oqu(i.locales.description),e.xp6(3),e.s9C("ngbTooltip",i.locales.notRequired),e.xp6(1),e.s9C("placeholder",i.locales.description+"..."),e.xp6(1),e.Q6J("ngIf",i.showECMInput),e.xp6(5),e.uIk("disabled",!!i.isDisabled||null),e.xp6(2),e.Oqu(i.locales.active),e.xp6(1),e.Q6J("ngIf",i.showActiveWarning),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("ngIf",7===i.assetPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.sg,Q.O5,c._Y,c.YN,c.Kr,c.Fj,c.Wl,c.EJ,c.JJ,c.JL,c.Q7,c.nD,c.sg,c.u,P._L,Ve.e,Qs.D]})}return r})();var he=F(92561);function Ir(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",4)(1,"div",5)(2,"button",6),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.logout())}),e._uU(3),e.qZA()()()}if(2&r){const t=e.oxw();e.xp6(3),e.Oqu(t.locales.logout)}}let at=(()=>{class r{constructor(t,s,i,o,a,d,m){this.activeModal=t,this.hosService=s,this.authService=i,this.carrierService=o,this.homebaseService=a,this.eventBus=d,this.router=m}ngOnInit(){}logout(){sessionStorage.clear(),this.hosService.hosVehicles=null,this.hosService.hosVehicles$=null,this.hosService.iftaVehicles=null,this.hosService.iftaVehicles$=null,this.hosService.hosDrivers=null,this.hosService.hosDrivers$=null,this.hosService.currentHOSDriver$=null,this.hosService.driversAdmin$=null,this.hosService.driversAdmin=null,this.hosService.homeBasesAdmin$=null,this.hosService.homeBasesAdmin=null,this.hosService.assetsAdmin$=null,this.hosService.assetsAdmin=null,this.hosService.notificationsAdmin$=null,this.hosService.notificationsAdmin=null,this.hosService.roleList=null,this.hosService.userList=null,this.hosService.carriers=[],this.hosService.carriers$=null,this.hosService.currentCarrier=null,this.hosService.currentCarrier$=null,this.hosService.userList=null,this.hosService.roleList=null,this.hosService.moaForUser=null,this.hosService.moaForUser$=null,this.hosService.moaList=null,this.hosService.changeMOA=!1,this.hosService.carrierSwitched=null,this.authService.appCredentials=null,this.authService.appCredentials$=null,this.authService.appReseller=null,this.authService.appReseller$=null,this.hosService.loginUser=null,this.hosService.logUser$=null,this.carrierService.loginUser=null,this.homebaseService.loginUser=null,this.authService.loginUser=null,this.hosService.firstUserLogin=null,this.hosService.currentCarrier=null,this.hosService.currentCarrier$=null,this.hosService.loginURL=!1,this.hosService.setCarriers([]),this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),setTimeout(()=>{this.activeModal.dismiss(),this.router.navigate(["/userlogin"]),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))},200)}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(y.T),e.Y36(p.e),e.Y36(I.V),e.Y36(we.s),e.Y36(n.Yd),e.Y36(Ie.F0))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-alert-message"]],inputs:{locales:"locales",alertMessage:"alertMessage",showCloseBtn:"showCloseBtn",partnerId:"partnerId"},decls:7,vars:3,consts:[[1,"modal-header"],[1,"icon","fas","fa-ban"],[1,"modal-body"],["class","modal-footer",4,"ngIf"],[1,"modal-footer"],[1,"d-flex","justify-content-center"],[1,"btn","btn-block","bg-gradient-danger",3,"click"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4"),e._UZ(2,"i",1),e._uU(3),e.qZA()(),e.TgZ(4,"div",2),e._uU(5),e.qZA(),e.YNc(6,Ir,4,1,"div",3)),2&s&&(e.xp6(3),e.hij(" ",i.locales.alert,"!"),e.xp6(2),e.hij(" ",i.alertMessage,"\n"),e.xp6(1),e.Q6J("ngIf",i.showCloseBtn&&5===i.partnerId))},dependencies:[Q.O5],styles:[".modal-header[_ngcontent-%COMP%], .modal
1-body[_ngcontent-%COMP%]{padding:9px 15px;border-bottom:1px solid #DC3545;background-color:#dc3545;color:#fff}"]})}return r})();function xr(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",17)(1,"input",18),e.NdJ("ngModelChange",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.selectedOption=i)})("change",function(){const o=e.CHM(t).$implicit,a=e.oxw(2);return e.KtG(a.onOptionChange(o.value))}),e.qZA(),e.TgZ(2,"label",19),e._uU(3),e.qZA()()}if(2&r){const t=l.$implicit,s=e.oxw(2);e.xp6(1),e.Q6J("id",t.value)("ngModel",s.selectedOption)("value",t.value),e.xp6(1),e.Q6J("for",t.id),e.xp6(1),e.hij(" ",t.label," ")}}function Or(r,l){if(1&r&&(e.TgZ(0,"option",20),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.HOSBillingId),e.xp6(1),e.hij(" ",t.ExternalUserName," ")}}const yt=function(r){return{display:r}};function Ur(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",9)(2,"p"),e._uU(3),e.qZA()(),e.TgZ(4,"div")(5,"div",10),e.YNc(6,xr,4,5,"div",11),e.qZA(),e.TgZ(7,"div",12)(8,"div",13)(9,"carrier-selector",14),e.NdJ("onCarrierSelected",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onCarrierSelected(i))}),e.qZA()()(),e.TgZ(10,"div",12)(11,"div",13)(12,"label"),e._uU(13,"Users"),e.qZA(),e.TgZ(14,"select",15),e.YNc(15,Or,2,2,"option",16),e.qZA()()()()()}if(2&r){const t=e.oxw();e.xp6(3),e.Oqu(t.locales.stop_logging_for),e.xp6(3),e.Q6J("ngForOf",t.options),e.xp6(1),e.Q6J("ngStyle",e.VKq(11,yt,"Carrier"===t.selectedOption?"block":"none")),e.xp6(2),e.Q6J("carriers",t.carriers)("selectedCarrier",t.selectedCarrierObj)("locales",t.locales)("selectorId","carrierSelectorTimeSelection")("label",(null==t.locales?null:t.locales.carrier)||"Carrier")("showLabel",!0),e.xp6(1),e.Q6J("ngStyle",e.VKq(13,yt,"Reseller"===t.selectedOption?"block":"none")),e.xp6(5),e.Q6J("ngForOf",t.allUsers)}}function Zr(r,l){if(1&r&&(e.TgZ(0,"div")(1,"p"),e._uU(2),e.TgZ(3,"span",9),e._uU(4),e.qZA(),e._uU(5),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.hij("",t.locales.suspend_logs_for_driver," "),e.xp6(2),e.Oqu(t.driver.HOSUserName),e.xp6(1),e.hij("? ",t.locales.select_duration,"")}}function wr(r,l){if(1&r&&(e.TgZ(0,"span",24),e._uU(1),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.hij(" ",t.selectedCarrierName,"")}}function Nr(r,l){if(1&r&&(e.TgZ(0,"span",24),e._uU(1),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.hij(" ",t.selectedResellerName,"")}}function Hr(r,l){if(1&r&&(e.TgZ(0,"div",7),e._uU(1),e.TgZ(2,"span"),e._uU(3),e.qZA(),e.YNc(4,wr,2,1,"span",23),e.YNc(5,Nr,2,1,"span",23),e._uU(6),e.TgZ(7,"span"),e._uU(8),e.qZA(),e._uU(9," Hour(s). "),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.stop_logs_for," "),e.xp6(2),e.Oqu(t.selectedOption),e.xp6(1),e.Q6J("ngIf","Carrier"===t.selectedOption),e.xp6(1),e.Q6J("ngIf","Reseller"===t.selectedOption),e.xp6(1),e.hij(" ",t.locales.for_," "),e.xp6(2),e.Oqu(t.selectedHrs)}}function Dr(r,l){if(1&r&&(e.TgZ(0,"div",7),e._uU(1),e.TgZ(2,"span"),e._uU(3),e.qZA(),e.TgZ(4,"span"),e._uU(5),e.qZA(),e._uU(6," Hour(s) "),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.stop_logs_for_system," "),e.xp6(2),e.Oqu(t.locales.for_),e.xp6(2),e.hij(" ",t.selectedHrs,"")}}function Fr(r,l){if(1&r&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.hij(" ",t.selectedCarrierName,"")}}function Mr(r,l){if(1&r&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.hij(" ",t.selectedResellerName,"")}}function kr(r,l){if(1&r&&(e.TgZ(0,"div",25),e._uU(1),e.TgZ(2,"span"),e._uU(3),e.qZA(),e.YNc(4,Fr,2,1,"span",4),e.YNc(5,Mr,2,1,"span",4),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.resume_uploading," "),e.xp6(2),e.Oqu(t.selectedOption),e.xp6(1),e.Q6J("ngIf","Carrier"===t.selectedOption),e.xp6(1),e.Q6J("ngIf","Reseller"===t.selectedOption)}}function qr(r,l){if(1&r&&(e.TgZ(0,"div",25),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.resume_logs_for_system," ")}}function Lr(r,l){if(1&r&&(e.TgZ(0,"div"),e.YNc(1,Hr,10,6,"div",21),e.YNc(2,Dr,7,3,"div",21),e.YNc(3,kr,6,4,"div",22),e.YNc(4,qr,2,1,"div",22),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf","All"!=t.selectedOption&&0!=t.selectedHrs),e.xp6(1),e.Q6J("ngIf","All"===t.selectedOption&&0!=t.selectedHrs),e.xp6(1),e.Q6J("ngIf","All"!=t.selectedOption&&0===t.selectedHrs),e.xp6(1),e.Q6J("ngIf","All"===t.selectedOption&&0===t.selectedHrs)}}function Jr(r,l){if(1&r&&(e.TgZ(0,"div",7),e._uU(1),e.TgZ(2,"span",24),e._uU(3),e.qZA(),e._uU(4),e.TgZ(5,"span"),e._uU(6),e.qZA(),e._uU(7," Hour(s). "),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.stop_logs_for_driver," "),e.xp6(2),e.Oqu(t.driver.HOSUserName),e.xp6(1),e.hij(" ",t.locales.for_," "),e.xp6(2),e.Oqu(t.selectedHrs)}}function Br(r,l){if(1&r&&(e.TgZ(0,"div",25),e._uU(1),e.TgZ(2,"span"),e._uU(3),e.qZA()()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",t.locales.resume_logs_for_driver," "),e.xp6(2),e.Oqu(t.driver.HOSUserName)}}function Er(r,l){if(1&r&&(e.TgZ(0,"div"),e.YNc(1,Jr,8,4,"div",21),e.YNc(2,Br,4,2,"div",22),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",0!=t.selectedHrs),e.xp6(1),e.Q6J("ngIf",0===t.selectedHrs)}}let At=(()=>
1{class r{constructor(t,s,i){this.activeModal=t,this.toast=s,this.utilService=i,this.submit=new e.vpe,this.selectedHrs=1,this.options=[{label:"Carrier",value:"Carrier"},{label:"Reseller",value:"Reseller"},{label:"System",value:"All"}],this.selectedOption="Carrier",this.allUsers=[],this.carriers=[]}ngOnInit(){this.carriers$&&this.carriers$.subscribe(t=>{t&&(this.carriers=t||[])}),this.allUsers=this.users,0==this.carriers.length||"Carrier"!==this.selectedOption||this.selectedCarrier||(this.selectedCarrier=String((this.carriers||[])[0].HOSClientId),this.selectedCarrierObj=this.carriers[0],this.selectedCarrierName=(this.carriers||[])[0].CarrierName)}ngOnDestroy(){$("#resellerSelect").off("change")}ngAfterViewInit(){const t=$("#resellerSelect");t.select2({placeholder:"--Select a user--",allowClear:!0}),t.on("change",s=>{let i=t.select2("data")[0];i?(this.selectedUser=i.id,this.selectedResellerName=i.text):(this.selectedUser=null,this.selectedResellerName=null)})}onCarrierSelected(t){t?(this.selectedCarrier=String(t.HOSClientId),this.selectedCarrierObj=t,this.selectedCarrierName=t.CarrierName):(this.selectedCarrier=null,this.selectedCarrierObj=null,this.selectedCarrierName=null)}ngDoCheck(){(this.closeTimeSelectionModal||this.closeDurationModal)&&this.activeModal.close()}onOptionChange(t){"Reseller"===this.selectedOption?(this.selectedCarrier=null,this.selectedCarrierObj=null,this.selectedCarrierName=null,this.selectedUser&&this.selectedResellerName||(this.selectedUser=String((this.allUsers||[])[0].HOSBillingId),this.selectedResellerName=(this.allUsers||[])[0].ExternalUserName)):"Carrier"===this.selectedOption?(this.selectedUser=null,this.selectedResellerName=null,this.selectedCarrier&&this.selectedCarrierName||(this.selectedCarrier=String((this.carriers||[])[0].HOSClientId),this.selectedCarrierObj=this.carriers[0],this.selectedCarrierName=(this.carriers||[])[0].CarrierName)):(this.selectedCarrier=null,this.selectedCarrierObj=null,this.selectedUser=null)}proceed(){this.submit.emit({duration:this.selectedHrs,level:this.selectedOption,carrierId:this.selectedCarrier,userId:this.selectedUser})}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(N.jE),e.Y36(b.f))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-time-selection"]],inputs:{locales:"locales",closeTimeSelectionModal:"closeTimeSelectionModal",closeDurationModal:"closeDurationModal",driver:"driver",users:"users",carriers$:"carriers$"},outputs:{submit:"submit"},decls:17,vars:7,consts:[[1,"modal-header"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],[4,"ngIf"],["for","number-input"],["type","number","id","number-input","min","0","step","1",1,"form-control",3,"ngModel","ngModelChange"],[1,"mt-3","mb-3","font-weight-bold"],["type","submit",1,"btn","btn-primary","float-right",3,"click"],[1,"font-weight-bold"],[1,"grid"],["class","form-check",4,"ngFor","ngForOf"],[3,"ngStyle"],[1,"form-group"],[3,"carriers","selectedCarrier","locales","selectorId","label","showLabel","onCarrierSelected"],["id","resellerSelect",1,"form-control","select2",2,"width","100%"],[3,"value",4,"ngFor","ngForOf"],[1,"form-check"],["type","radio",1,"form-check-input",3,"id","ngModel","value","ngModelChange","change"],[1,"form-check-label",3,"for"],[3,"value"],["class","mt-3 mb-3 font-weight-bold",4,"ngIf"],["class","mt-3 mb-3 font-weight-bold text-danger",4,"ngIf"],["class","text-primary",4,"ngIf"],[1,"text-primary"],[1,"mt-3","mb-3","font-weight-bold","text-danger"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"button",1),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(2,"span",2),e._uU(3,"\xd7"),e.qZA()()(),e.TgZ(4,"div",3),e.YNc(5,Ur,16,15,"div",4),e.YNc(6,Zr,6,3,"div",4),e.TgZ(7,"div")(8,"div")(9,"label",5),e._uU(10),e.qZA(),e.TgZ(11,"input",6),e.NdJ("ngModelChange",function(a){return i.selectedHrs=a}),e.qZA()()(),e.YNc(12,Lr,5,4,"div",4),e.YNc(13,Er,3,2,"div",4),e.TgZ(14,"div",7)(15,"button",8),e.NdJ("click",function(){return i.proceed()}),e._uU(16),e.qZA()()()),2&s&&(e.xp6(5),e.Q6J("ngIf",i.carriers&&0!=i.carriers.length&&i.allUsers&&0!=i.allUsers.length),e.xp6(1),e.Q6J("ngIf",i.carriers&&0===i.carriers.length),e.xp6(4),e.Oqu(i.locales.hours),e.xp6(1),e.Q6J("ngModel",i.selectedHrs),e.xp6(1),e.Q6J("ngIf",i.carriers&&0!=i.carriers.length&&i.allUsers&&0!=i.allUsers.length),e.xp6(1),e.Q6J("ngIf",i.carriers&&0===i.carriers.length),e.xp6(3),e.Oqu(i.locales.proceed))},dependencies:[Q.sg,Q.O5,Q.PC,c.YN,c.Kr,c.Fj,c.wV,c._,c.JJ,c.qQ,c.On,Ve.e],styles:[".grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr)}"]})}return r})();var Pr=F(17930),It=F(92218),xt=F(80823);let Ot=(()=>
1{class r{constructor(){this._loading$=new ye.X(!0),this._loaded$=new ye.X(!1),this._search$=new It.xQ,this._dataset$=new ye.X([]),this._total$=new ye.X(0),this.config={columns:[],data:[],matchFn:()=>{}},this._state={page:1,pageSize:10,searchTerm:"",sortColumn:"",sortDirection:""}}get dataset$(){return this._dataset$.asObservable()}set dataset$(t){this._dataset$.next(t)}get total$(){return this._total$.asObservable()}get loading$(){return this._loading$.asObservable()}get loaded$(){return this._loaded$.asObservable()}get page(){return this._state.page}get pageSize(){return this._state.pageSize}get searchTerm(){return this._state.searchTerm}set page(t){this._set({page:t})}set pageSize(t){this._set({pageSize:t})}set searchTerm(t){this._set({searchTerm:t})}set sortColumn(t){this._set({sortColumn:t})}set sortDirection(t){this._set({sortDirection:t})}initDataTable(t){this.config=t,this._loading$.next(!0),this._search$.pipe((0,x.b)(()=>this._loading$.next(!0)),(0,x.b)(()=>this._loaded$.next(!1)),(0,xt.b)(100),(0,T.w)(()=>this._search()),(0,C.g)(100),(0,x.b)(()=>this._loading$.next(!1)),(0,x.b)(()=>this._loaded$.next(!0))).subscribe(s=>{this._dataset$.next(s.dataset),this._total$.next(s.total)}),this._search$.next()}_set(t){Object.assign(this._state,t),this._search$.next()}_search(){const{sortColumn:t,sortDirection:s,pageSize:i,page:o,searchTerm:a}=this._state;let d=function Yr(r,l,t){return""===t||""===l?r:[...r].sort((s,i)=>{const o=((r,l)=>r<l?-1:r>l?1:0)(`${s[l]}`,`${i[l]}`);return"asc"===t?o:-o})}(this.config.data,t,s);d=d.filter(v=>this.config.matchFn(v,a));const m=d.length;return d=d.slice((o-1)*i,(o-1)*i+i),(0,_.of)({dataset:d,total:m})}static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275prov=e.Yz7({token:r,factory:r.\u0275fac})}return r})();function $r(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",18),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.addCarrier())}),e._UZ(1,"i",19),e._uU(2),e.qZA()}if(2&r){const t=e.oxw();e.xp6(2),e.hij(" ",t.locales.newItem," ")}}function Qr(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"carrier-selector",20),e.NdJ("onCarrierSelected",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onCarrierSelectedFromSelector(i))}),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.Q6J("carriers",t.carriers)("selectedCarrier",t.currentCarrier)("locales",t.locales)("selectorId","carrierSelectorManage")("showLabel",!1)}}function Vr(r,l){if(1&r&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(null==t.currentCarrier?null:t.currentCarrier.Name)}}function Wr(r,l){1&r&&(e.TgZ(0,"span",25),e._uU(1,"Suspended"),e.qZA())}function zr(r,l){1&r&&(e.TgZ(0,"span",26),e._uU(1,"Inactive"),e.qZA())}function jr(r,l){1&r&&(e.TgZ(0,"span",27),e._uU(1,"Closed"),e.qZA())}function Gr(r,l){if(1&r&&(e.TgZ(0,"td",21),e._uU(1),e.YNc(2,Wr,2,0,"span",22),e.YNc(3,zr,2,0,"span",23),e.YNc(4,jr,2,0,"span",24),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.currentCarrier.CarrierId," "),e.xp6(1),e.Q6J("ngIf",2===(null==t.currentCarrier?null:t.currentCarrier.Status)),e.xp6(1),e.Q6J("ngIf",3===(null==t.currentCarrier?null:t.currentCarrier.Status)),e.xp6(1),e.Q6J("ngIf",4===(null==t.currentCarrier?null:t.currentCarrier.Status))}}function Kr(r,l){1&r&&e._UZ(0,"td",13)}function Xr(r,l){if(1&r&&e._UZ(0,"img",33),2&r){const t=e.oxw(2).$implicit;e.s9C("alt",t.label),e.Q6J("src",t.icon,e.LSH)}}function eo(r,l){if(1&r&&(e.ynx(0),e.YNc(1,Xr,1,2,"img",32),e.BQk()),2&r){const t=e.oxw(3);e.xp6(1),e.Q6J("ngIf",1===(null==t.currentCarrier?null:t.currentCarrier.AIVisionEnabled))}}function to(r,l){if(1&r&&e._UZ(0,"i",34),2&r){const t=e.oxw().$implicit;e.Tol(t.icon+" font-size fmcsa-font-size")}}function io(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",29),e.NdJ("click",function(i){const a=e.CHM(t).$implicit,d=e.oxw(2);return e.KtG(d.onActionClick(i,a.link,d.currentCarrier))}),e.YNc(1,eo,2,1,"ng-container",30),e.YNc(2,to,1,2,"ng-template",null,31,e.W1O),e.qZA()}if(2&r){const t=l.$implicit,s=e.MAs(3);e.s9C("title",t.label),e.xp6(1),e.Q6J("ngIf",t.icon.endsWith(".svg"))("ngIfElse",s)}}function so(r,l){if(1&r&&(e.TgZ(0,"div"),e.YNc(1,io,4,3,"button",28),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngForOf",t.items)}}function ro(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"button",35)(2,"i",36),e.NdJ("click",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onActionClick(i,o.items[0].link,o.currentCarrier))}),e.qZA()()()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.items[0].text),e.xp6(1),e.Gre("fas fa-",t.items[0].icon,"")}}function oo(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"carrier-selector",20),e.NdJ("onCarrierSelected",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onCarrierSelectedFromSelector(i))}),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.Q6J("carriers",t.carriers)("selectedCarrier",t.currentCarrier)("locales",t.locales)("selectorId","carrierSelectorManageResp")("showLabel",!1)}}function no(r,l){if(1&r&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(null==t.currentCarrier?null:t.currentCarrier.Name)}}function ao(r,l){if(1&r&&(e.TgZ(0,"div"),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.currentCarrier.CarrierId," ")}}function lo(r,l){1&r&&e._UZ(0,"div",13)}function co(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",35)(1,"i",38),e.NdJ("click",function(i){const a=e.CHM(t).$implicit,d=e.oxw(2);return e.KtG(d.onActionClick(i,a.link,d.currentCarrier))}),e.qZA()()}if(2&r){const t=l.$implicit;e.s9C("title",t.label),e.xp6(1),e.Gre("fas fa-",t.icon,"")}}function mo(r,l){if(1&r&&(e.TgZ(0,"div"),e.YNc(1,co,2,4,"button",37),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngForOf",t.items)}}function uo(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"button",35)(2,"i",36),e.NdJ("click",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.onActionClick(i,o.items[0].link,o.currentCarrier))}),e.qZA()()()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.items[0].text),e.xp6(1),e.Gre("fas fa-",t.items[0].icon,"")}}function ho(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",35)(1,"i",38),e.NdJ("click",function(i){const a=e.CHM(t).$implicit,d=e.oxw(2);return e.KtG(d.onActionClick(i,a.link,d.currentCarrier))}),e.qZA()()}if(2&r){const t=l.$implicit;e.s9C("title",t.label),e.xp6(1),e.Gre("fas fa-",t.icon,"")}}function po(r,l){if(1&r&&(e.TgZ(0,"div",39)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA()(),e.TgZ(5,"div",6)(6,"table",7)(7,"thead")(8,"tr")(9,"td",8),e._uU(10),e.qZA(),e.TgZ(11,"td",40),e._uU(12),e.qZA()()(),e.TgZ(13,"tbody")(14,"tr")(15,"td",41)(16,"span"),e._uU(17),e.qZA()(),e.TgZ(18,"td",13)(19,"div"),e.YNc(20,ho,2,4,"button",37),e.qZA()()()()()()()()),2&r){const t=e.oxw();e.xp6(4),e.Oqu(t.locales.moa),e.xp6(6),e.Oqu(t.locales.name),e.xp6(2),e.Oqu(t.locales.actions),e.xp6(
15),e.Oqu(t.moaForUser?null==t.moaForUser[0]?null:t.moaForUser[0].HOSAccountName:""),e.xp6(3),e.Q6J("ngForOf",t.items)}}let lt=(()=>{class r{constructor(t,s,i,o){this.modalService=t,this.dataTableService=s,this.hosService=i,this.authService=o,this.onItemClick=new e.vpe,this.onCarrierUpdate=new e.vpe,this.onCarrierChange=new e.vpe,this.onShowDrivers=new e.vpe,this.onShowHomeBases=new e.vpe,this.onShowAssets=new e.vpe,this.onAddCarrier=new e.vpe,this.onTableChanged=new e.vpe,this.config={columns:[],data:[],matchFn:(a,d,m,v)=>a.Name.toLowerCase().includes(d.toLowerCase())},this.title="Carriers",this.fullCarrierPermission=!1,this.showTable=!0,this.isServerSideSearch=!1,this.carrierListSub=new V.w}ngOnInit(){this.loginUser=this.hosService.loginUser,this.partnerId=this.authService.appCredentials.partnerId,this.isServerSideSearch=!0,this.loginUser&&this.carrierPermissions(),$("#carrierContainer").hide(),$("#moaContainer").hide(),this.showTable=!(window.innerWidth>=200&&window.innerWidth<=1024)}ngOnChanges(t){if(this.carriers?.length>=2&&this.currentCarrier?.HOSClientId>0){const s=this.carriers.findIndex(i=>-1===i.index);-1!==s&&(this.carriers.splice(s,1),this.carriers.forEach((i,o)=>i.index=o))}this.loginUser&&(9===this.loginUser.HOSUserTypeId||this.moaForUser&&0!==this.moaForUser.length)?(this.onTableChanged.emit(!1),$("#moaContainer").show(),$("#carrierContainer").hide()):(this.onTableChanged.emit(!0),$("#carrierContainer").show(),$("#moaContainer").hide()),this.pushAIVisionIcon()}ngAfterViewInit(){this.loginUser&&(9===this.loginUser.HOSUserTypeId||this.moaForUser&&0!==this.moaForUser.length)?$("#moaContainer").show():$("#carrierContainer").show()}onCarrierSelectedFromSelector(t){if(!t)return;this.hosService.manageMenu=!0;const s=this.carriers.findIndex(i=>i.HOSClientId===t.HOSClientId);if(-1===s?(t.index=this.carriers.length,this.carriers.push(t)):t.index=s,t.HOSClientId>0){const i=this.carriers.findIndex(o=>-1===o.index);-1!==i&&(this.carriers.splice(i,1),this.carriers.forEach((o,a)=>o.index=a))}this.onCarrierChange.emit(t),this.pushAIVisionIcon()}ngOnDestroy(){this.carrierListSub.unsubscribe()}pushAIVisionIcon(){if(!this.currentCarrier)return;const{AIVisionEnabled:t=0}=this.currentCarrier,s=(this.items||[]).findIndex(i=>"aiVision"===i.link);1===t&&-1===s?this.items.push({label:"AI Vision",link:"aiVision",icon:"../../../assets/fonts/fonts/dashcam.svg"}):1!==t&&-1!==s&&this.items.splice(s,1)}carrierPermissions(){this.fullCarrierPermission=!!this.loginUser.HOSRole?.PermissionIds?.find(t=>1===t)}openCarrierForm(t){const s=this.modalService.open(tt,{scrollable:!0});s.componentInstance.carrier={...t},s.result.then(i=>{t=JSON.parse(JSON.stringify(i))},i=>{console.log("--reason--"),console.log(`Dismissed ${this.getDismissReason(i)}`)})}addCarrier(){this.onAddCarrier.emit(!0)}getDismissReason(t){return t===P.If.ESC?"by pressing ESC":t===P.If.BACKDROP_CLICK?"By clicking on a backdrop":`with ${t}`}onActionClick(t,s,i){this.onItemClick.emit({action:s,itemData:i,moa:this.moaForUser})}showDrivers(t){this.onShowDrivers.emit(t)}showHomeBase(t){this.onShowHomeBases.emit(t)}showAssets(t){this.onShowAssets.emit(t)}getHomeBases(t){if(-1!==t){let s=this.carriers.find(i=>i.index===t);s&&this.carrierListSub.add(this.hosService.getHomeBases(s).subscribe(i=>{this.hosService.homeBasesAdmin$=[...i],this.hosService.homeBasesAdmin=[...i]}))}}get MOAForUser(){return this.hosService.moaForUser}onResize(t){this.showTable=!(window.innerWidth>=375&&window.innerWidth<=1024)}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.FF),e.Y36(Ot),e.Y36(y.T),e.Y36(p.e))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["carrier-list"]],viewQuery:function(s,i){if(1&s&&e.Gf(Pr.j,5),2&s){let o;e.iGM(o=e.CRH())&&(i.headers=o)}},hostBindings:function(s,i){1&s&&e.NdJ("resize",function(a){return i.onResize(a)},!1,e.Jf7)},inputs:{carriers:"carriers",currentCarrier:"currentCarrier",locales:"locales",items:"items",moaForUser:"moaForUser"},outputs:{onItemClick:"onItemClick",onCarrierUpdate:"onCarrierUpdate",onCarrierChange:"onCarrierChange",onShowDrivers:"onShowDrivers",onShowHomeBases:"onShowHomeBases",onShowAssets:"onShowAssets",onAddCarrier:"onAddCarrier",onTableChanged:"onTableChanged"},features:[e.TTD],decls:47,vars:31,consts:[["id","carrierContainer",1,"container"],[1,"card"],[1,"card-header"],[1,"card-title"],[1,"card-tools"],["type","button","class","btn btn-outline-primary",3,"click",4,"ngIf"],[1,"card-body"],[1,"table","table-sm"],[1,"center-name"],[1,"upper-center"],[4,"ngIf"],["class","center-width30",4,"ngIf"],["class","text-center",4,"ngIf"],[1,"text-center"],[1,"list-group","list-group-flush"],[1,"list-group-item"],[1,"center-width100"],["class","container","id","moaContainer",4,"ngIf"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],[3,"carriers","selectedCarrier","locales","selectorId","showLabel","onCarrierSelected"],[1,"center-width30"],["class","badge badge-warning ml-1",4,"ngIf"],["class","badge badge-secondary ml-1",4,"ngIf"],["class","badge badge-danger ml-1",4,"ngIf"],[1,"badge","badge-warning","ml-1"],[1,"badge","badge-secondary","ml-1"],[1,"badge","badge-danger","ml-1"],["type","button","class","btn btn-link","data-toggle","tooltip","data-
1placement","top",3,"title","click",4,"ngFor","ngForOf"],["type","button","data-toggle","tooltip","data-placement","top",1,"btn","btn-link",3,"title","click"],[4,"ngIf","ngIfElse"],["fontAwesomeIcon",""],[3,"src","alt",4,"ngIf"],[3,"src","alt"],[2,"margin-left","5px"],["type","button","data-toggle","tooltip","data-placement","top",1,"btn","btn-link",3,"title"],[3,"click"],["type","button","class","btn btn-link","data-toggle","tooltip","data-placement","top",3,"title",4,"ngFor","ngForOf"],[2,"margin-left","5px",3,"click"],["id","moaContainer",1,"container"],[1,"center-actions"],[1,"center-dot-account"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA(),e.TgZ(5,"div",4),e.YNc(6,$r,3,1,"button",5),e.qZA()(),e.TgZ(7,"div",6)(8,"div")(9,"table",7)(10,"thead")(11,"tr")(12,"td"),e._uU(13),e.qZA(),e.TgZ(14,"td",8),e._uU(15),e.qZA(),e.TgZ(16,"td",9),e._uU(17),e.qZA()()(),e.TgZ(18,"tbody")(19,"tr")(20,"td"),e.YNc(21,Qr,2,5,"div",10),e.YNc(22,Vr,2,1,"span",10),e.qZA(),e.YNc(23,Gr,5,4,"td",11),e.YNc(24,Kr,1,0,"td",12),e.TgZ(25,"td",13),e.YNc(26,so,2,1,"div",10),e.YNc(27,ro,3,4,"div",10),e.qZA()()()()(),e.TgZ(28,"ul",14)(29,"li",15)(30,"div",9),e._uU(31),e.qZA(),e.TgZ(32,"div",16),e.YNc(33,oo,2,5,"div",10),e.YNc(34,no,2,1,"span",10),e.qZA()(),e.TgZ(35,"li",15)(36,"div",9),e._uU(37),e.YNc(38,ao,2,1,"div",10),e.qZA(),e.YNc(39,lo,1,0,"div",12),e.qZA(),e.TgZ(40,"li",15)(41,"div",9),e._uU(42),e.qZA(),e.TgZ(43,"div",13),e.YNc(44,mo,2,1,"div",10),e.YNc(45,uo,3,4,"div",10),e.qZA()()()()()(),e.YNc(46,po,21,5,"div",17)),2&s&&(e.xp6(4),e.Oqu(i.locales.carriers),e.xp6(2),e.Q6J("ngIf",i.loginUser&&5===i.loginUser.HOSPartnerId&&(1===i.loginUser.HOSUserTypeId||2===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Udp("display",i.showTable?"block":"none"),e.xp6(1),e.ekj("server-side-table",i.isServerSideSearch),e.xp6(3),e.Tol(i.isServerSideSearch?"carrier-name-col-wide":"center-name"),e.xp6(1),e.Oqu(i.locales.name),e.xp6(2),e.Oqu(i.locales.dotnscNumber),e.xp6(2),e.Oqu(i.locales.actions),e.xp6(3),e.Tol(i.isServerSideSearch?"carrier-name-col-wide":"center-width30"),e.xp6(1),e.Q6J("ngIf",(null==i.carriers?null:i.carriers.length)>1||i.isServerSideSearch),e.xp6(1),e.Q6J("ngIf",1===(null==i.carriers?null:i.carriers.length)||2===(null==i.carriers?null:i.carriers.length)&&-1===(null==i.carriers[0]?null:i.carriers[0].index)),e.xp6(1),e.Q6J("ngIf",(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)>0),e.xp6(1),e.Q6J("ngIf",null===i.currentCarrier||(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)<=0),e.xp6(2),e.Q6J("ngIf",(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)>0),e.xp6(1),e.Q6J("ngIf",i.currentCarrier&&(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)<=0),e.xp6(1),e.Udp("display",i.showTable?"n
1one":"block"),e.xp6(3),e.Oqu(i.locales.name),e.xp6(2),e.Q6J("ngIf",(null==i.carriers?null:i.carriers.length)>1||i.isServerSideSearch),e.xp6(1),e.Q6J("ngIf",1===(null==i.carriers?null:i.carriers.length)||2===(null==i.carriers?null:i.carriers.length)&&-1===(null==i.carriers[0]?null:i.carriers[0].index)),e.xp6(3),e.hij(" ",i.locales.dotnscNumber," "),e.xp6(1),e.Q6J("ngIf",(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)>0),e.xp6(1),e.Q6J("ngIf",null===i.currentCarrier||(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)<=0),e.xp6(3),e.hij(" ",i.locales.actions," "),e.xp6(2),e.Q6J("ngIf",(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)>0),e.xp6(1),e.Q6J("ngIf",i.currentCarrier&&(null==i.currentCarrier?null:i.currentCarrier.HOSClientId)<=0),e.xp6(1),e.Q6J("ngIf",5===i.partnerId&&(null==i.moaForUser?null:i.moaForUser.length)>0))},dependencies:[Q.sg,Q.O5,Ve.e],styles:['.table[_ngcontent-%COMP%] .carrier-name[_ngcontent-%COMP%]{font-family:Arial,Helvetica,sans-serif;font-size:.85rem;font-weight:400;text-transform:uppercase}.table[_ngcontent-%COMP%] .font-size[_ngcontent-%COMP%]{font-size:20px}.table[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{font-size:.85rem;padding:0 .25rem}[class^=icon-][_ngcontent-%COMP%]:before, [class*=" icon-"][_ngcontent-%COMP%]:before{font-size:2rem}.center-dot-account[_ngcontent-%COMP%]{width:30%;text-align:center}.center-name[_ngcontent-%COMP%]{width:30%;text-transform:uppercase;text-align:center}.center-actions[_ngcontent-%COMP%]{text-transform:uppercase;text-align:center}.text-center[_ngcontent-%COMP%]{text-align:center}.center-width100[_ngcontent-%COMP%]{width:100%;text-align:center}.center-width30[_ngcontent-%COMP%]{width:30%;text-align:center}.carrier-name-col-wide[_ngcontent-%COMP%]{width:450px;min-width:450px;text-align:center;text-transform:uppercase}.server-side-table[_ngcontent-%COMP%]{table-layout:auto;width:auto;min-width:100%}.upper-center[_ngcontent-%COMP%]{text-transform:uppercase;text-align:center}.upper-item[_ngcontent-%COMP%]{text-transform:uppercase}'],changeDetection:0})}return r})();var fo=F(14620),Ut=F(14331),ct=F(86985),go=F(83464),vo=F(770),_o=F(80991),So=F(99579),bo=F(36668),Zt=F(92340),wt=F(4459);let Co=(()=>{class r{constructor(t,s){this.http=t,this.appConfig=s,this.baseURL=this.appConfig.getCurrentServer(Zt.N.serverName),this.httpOptions={headers:new Je.WM({"Content-Type":"application/json"})}}getUsersAppSupportByCarrier(t){return this.http.post(this.baseURL+"/GetHOSUsersAppSupportByCarrier",{HOSClientId:t},this.httpOptions)}static#e=this.\u0275fac=function(s){return new(s||r)(e.LFG(Je.eN),e.LFG(wt.X))};static#t=this.\u0275prov=e.Yz7({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var Nt=F(1584),dt=F(53447),To=F(30294),yo=F(17925);class Ht{}let Dt=(()=>{class r{constructor(t,s){this.http=t,this.appConfig=s,this.baseURL=this.appConfig.getCurrentServer(Zt.N.serverName),this.httpOptions={headers:new Je.WM({"Content-Type":"application/json"})},this.typeFileList=[{id:0,label:"Not File"},{id:1,label:"HOSECMLogs.csv"},{id:2,label:"HOSLogs.csv"},{id:3,label:"All Files"}]}SendHOSLogECMPushNotification(t){return this.http.post(`${this.baseURL}/SendHOSLogECMPushNotification`,{HOSLogECMRequestDTO:t},this.httpOptions)}static#e=this.\u0275fac=function(s){return new(s||r)(e.LFG(Je.eN),e.LFG(wt.X))};static#t=this.\u0275prov=e.Yz7({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();var Ao=F(64897);function Io(r,l){if(1&r&&(e.TgZ(0,"span",32),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij("",t.locales.required," ")}}function xo(r,l){if(1&r&&(e.TgZ(0,"span",32),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.onlyNumbers," ")}}function Oo(r,l){1&r&&(e.TgZ(0,"span",32),e._uU(1," Occurrence Time has to be greater than 0. "),e.qZA())}function Uo(r,l){if(1&r&&(e.TgZ(0,"option",33),e._uU(1),e.qZA()),2&r){const t=l.$implicit;e.Q6J("value",t.id),e.xp6(1),e.Oqu(t.label)}}function Zo(r,l){if(1&r&&(e.TgZ(0,"div",34)(1,"button",35),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",36),e._uU(5),e.qZA(),e._UZ(6,"div",37),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.Q6J("innerHTML",t.formState.message,e.oJD)}}function wo(r,l){1&r&&e._UZ(0,"span",38)}function No(r,l){if(1&r&&(e.TgZ(0,"span",39),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.loading)}}const Ho=function(r){return{"is-invalid":r}};let Ft=(()=>
1{class r{constructor(t,s,i,o,a,d){this.activeModal=t,this.fb=s,this.administrationService=i,this.dateAdapter=o,this.calendar=a,this.utilService=d,this.onSubmit=new e.vpe,this.meridian=!1}ngOnInit(){this.typeFileList=this.administrationService.typeFileList,this.dateModelStart=this.dateAdapter.toModel(this.calendar.getToday()),this.dateModelEnd=this.dateAdapter.toModel(this.calendar.getToday());let t={hour:(new Date).getHours(),minute:(new Date).getMinutes()},s={hour:(new Date).getHours()+1,minute:(new Date).getMinutes()};this.abbrev=this.utilService.getTimeZoneAbbreviation(this.carrier?this.carrier.TimeZoneCode:this.driver.TimeZoneCode),this.ecmDataForm=this.fb.group({logEcmData:["",[c.kI.required]],occurrenceTime:[1,[c.kI.required,u.s.checkNumber]],startTimestamp:[t,[c.kI.required]],endTimestamp:[s,[c.kI.required]],typeFile:["",[c.kI.required]]}),this.TypeFile.setValue(0)}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close()}ngOnDestroy(){$(".select2-container").removeClass("select2-container--open"),$("#typeFile").remove()}ngAfterViewInit(){$("#typeFile").select2(),$("#typeFile").on("change",t=>{this.ecmDataForm.get("typeFile").setValue(t.target.value),this.ecmDataForm.markAsDirty()})}dateSelectedStart(t){this.dateModelStart=this.dateAdapter.toModel(t)}dateSelectedEnd(t){this.dateModelEnd=this.dateAdapter.toModel(t)}get today(){return this.dateAdapter.toModel(this.calendar.getToday())}get LogECMData(){return this.ecmDataForm.get("logEcmData")}get OccurrenceTime(){return this.ecmDataForm.get("occurrenceTime")}get StartTimestamp(){return this.ecmDataForm.get("startTimestamp")}get EndTimestamp(){return this.ecmDataForm.get("endTimestamp")}get TypeFile(){return this.ecmDataForm.get("typeFile")}required(t){return this.ecmDataForm.get(`${t}`).hasError("required")&&this.ecmDataForm.get(`${t}`).touched}keyPressNumbers(t){let s=t.which?t.which:t.keyCode;return!(s<48||s>57)||(t.preventDefault(),!1)}onValueAdd(t,s){let i=t.trim();this.ecmDataForm.get(`${s}`).setValue(i)}submitForm(){let t=this.utilService.convertTimeToString(this.StartTimestamp.value),s=this.utilService.convertTimeToString(this.EndTimestamp.value),i=this.utilService.getEpochTimeStamp(this.dateModelStart+t),o=this.utilService.getEpochTimeStamp(this.dateModelEnd+s),a="";if(i>=o&&(a+="WRONG DATE RANGE. End time has to be grather than start time.</br>"),this.OccurrenceTime.value<1&&(a+="Occurrence Time has to be greater than 0. </br>"),""!==a)this.formState={loading:!1,submited:!1,errors:!0,message:a};else{let d=new Ht;d.LogEcmData=!0===this.LogECMData.value?1:0,d.OccurrenceTime=parseInt(this.OccurrenceTime.value),d.StartTimestamp=i,d.EndTimestamp=o,d.TypeFile=parseInt(this.TypeFile.value),d.HOSDriverId=this.driver.HOSDriverId,this.onSubmit.emit(d)}}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(c.QS),e.Y36(Dt),e.Y36(P.DO),e.Y36(P.vL),e.Y36(b.f))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-ecm-log-data"]],inputs:{ecmLogData:"ecmLogData",locales:"locales",driver:"driver",formState:"formState",carrier:"carrier"},outputs:{onSubmit:"onSubmit"},decls:72,vars:25,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["id","ecmLogDataForm","role","form","novalidate","",3,"formGroup","ngSubmit"],["ngbAutofocus","",1,"card-body"],[1,"form-group"],[1,"form-check"],["type","checkbox","id","logEcmData","formControlName","logEcmData",1,"form-check-input"],["for","logEcmData",1,"form-check-label"],[1,"row"],[1,"col-6"],["for","driverName"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["type","number","formControlName","occurrenceTime","placeholder","Occurrence Time","maxlength","30","min","1","required","",1,"form-control",3,"ngClass","keypress","change"],["class","error invalid-feedback",4,"ngIf"],["for","startTimestamp"],[3,"dateModel","onDateSelected"],["name","startTime","formControlName","startTimestamp",3,"meridian"],["name","endTime","formControlName","endTimestamp",3,"meridian"],["for","homebase"],["formControlName","typeFile","id","typeFile",1,"form-control",2,"width","100%"],[3,"value",4,"ngFor","ngForOf"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"modal-footer"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["class","spinner-border spinner-border-sm","role","status","aria-hidden","true",4,"ngIf"],["class","sr-only",4,"ngIf"],["type","button",1,"btn","btn-outline-dark",3,"click"],[1,"error","invali
1d-feedback"],[3,"value"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"],[3,"innerHTML"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"sr-only"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"form",5),e.NdJ("ngSubmit",function(){return i.submitForm()}),e.TgZ(8,"div",6)(9,"div",7)(10,"div",8),e._UZ(11,"input",9),e.TgZ(12,"label",10),e._uU(13,"Log Ecm Data"),e.qZA()()(),e.TgZ(14,"div",7)(15,"div",11)(16,"div",12)(17,"label",13),e._uU(18,"Occurrence Time (min)"),e.qZA(),e.TgZ(19,"span",14),e._uU(20,"*"),e.qZA()(),e.TgZ(21,"div",12)(22,"span",15),e._UZ(23,"i",16),e.qZA()()(),e.TgZ(24,"input",17),e.NdJ("keypress",function(a){return i.keyPressNumbers(a)})("change",function(a){return i.onValueAdd(a.target.value,"occurrenceTime")}),e.qZA(),e.YNc(25,Io,2,1,"span",18),e.YNc(26,xo,2,1,"span",18),e.YNc(27,Oo,2,0,"span",18),e.qZA(),e.TgZ(28,"div",7)(29,"div",11)(30,"div",12)(31,"label",19),e._uU(32),e.qZA(),e.TgZ(33,"span",14),e._uU(34,"*"),e.qZA()(),e.TgZ(35,"div",12)(36,"span",15),e._UZ(37,"i",16),e.qZA()()(),e.TgZ(38,"app-date-picker",20),e.NdJ("onDateSelected",function(a){return i.dateSelectedStart(a)}),e.qZA(),e._UZ(39,"ngb-timepicker",21),e.qZA(),e.TgZ(40,"div",7)(41,"div",11)(42,"div",12)(43,"label",13),e._uU(44),e.qZA(),e.TgZ(45,"span",14),e._uU(46,"*"),e.qZA()(),e.TgZ(47,"div",12)(48,"span",15),e._UZ(49,"i",16),e.qZA()()(),e.TgZ(50,"app-date-picker",20),e.NdJ("onDateSelected",function(a){return i.dateSelectedEnd(a)}),e.qZA(),e._UZ(51,"ngb-timepicker",22),e.qZA(),e.TgZ(52,"div",7)(53,"div",11)(54,"div",12)(55,"label",23),e._uU(56,"Type File"),e.qZA(),e.TgZ(57,"span",14),e._uU(58,"*"),e.qZA()(),e.TgZ(59,"div",12)(60,"span",15),e._UZ(61,"i",16),e.qZA()()(),e.TgZ(62,"select",24),e.YNc(63,Uo,2,2,"option",25),e.qZA()(),e.YNc(64,Zo,7,2,"div",26),e.qZA()()(),e.TgZ(65,"div",27)(66,"button",28),e.NdJ("click",function(){return i.submitForm()}),e.YNc(67,wo,1,0,"span",29),e.YNc(68,No,2,1,"span",30),e._uU(69),e.qZA(),e.TgZ(70,"button",31),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(71),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.ecmData),e.xp6(5),e.Q6J("formGroup",i.ecmDataForm),e.xp6(16),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.Q6J("ngClass",e.VKq(23,Ho,(null==i.OccurrenceTime?null:i.OccurrenceTime.errors)&&i.OccurrenceTime.touched||i.OccurrenceTime.value<1)),e.xp6(1),e.Q6J("ngIf",i.required("occurrenceTime")),e.xp6(1),e.Q6J("ngIf",(null==i.OccurrenceTime||null==i.OccurrenceTime.errors?null:i.OccurrenceTime.errors.checkNumber)&&i.OccurrenceTime.touched),e.xp6(1),e.Q6J("ngIf",i.OccurrenceTime.value<1),e.xp6(5),e.hij("Start Timestamp ",i.abbrev,""),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.Q6J("dateModel",i.dateModelStart),e.xp6(1),e.Q6J("meridian",i.meridian),e.xp6(5),e.hij("End Timestamp ",i.abbrev,""),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.Q6J("dateModel",i.dateModelEnd),e.xp6(1),e.Q6J("meridian",i.meridian),e.xp6(10),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(2),e.Q6J("ngForOf",i.typeFileList),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("disabled",i.OccurrenceTime.value<1),e.xp6(1),e.Q6J("ngIf",i.formState.loading),e.xp6(1),e.Q6J("ngIf",i.formState.loading),e.xp6(1),e.hij(" ",i.locales.save," "),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.mk,Q.sg,Q.O5,P.Pm,P._L,c._Y,c.YN,c.Kr,c.Fj,c.wV,c.Wl,c.EJ,c.JJ,c.JL,c.Q7,c.nD,c.qQ,c.sg,c.u,Ao.L]})}return r})();var Be=F(85703);const Do=["fileInput"];function Fo(r,l){1&r&&e._uU(0),2&r&&e.hij(" ",l.item.label," ")}function Mo(r,l){if(1&r&&(e.TgZ(0,"span",45),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function ko(r,l){1&r&&(e.TgZ(0,"span",13),e._uU(1,"*"),e.qZA())}function qo(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"i",46),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.removeFile())}),e.qZA()}if(2&r){const t=e.oxw();e.s9C("title",t.locales.removeFile)}}function Lo(r,l){if(1&r&&(e.TgZ(0,"span",47),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.invalidFileType," ")}}function Jo(r,l){if(1&r&&(e.TgZ(0,"span",47),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",t.locales.invalidSize," ")}}function Bo(r,l){if(1&r&&(e.TgZ(0,"span",48),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.required)}}function Eo(r,l){if(1&r&&(e.TgZ(0,"div",49)(1,"button",50),e._uU(2,"\xd7"),e.qZA(),e.TgZ(3,"h5"),e._UZ(4,"i",51),e._uU(5),e.qZA(),e._UZ(6,"div",52),e.qZA()),2&r){const t=e.oxw();e.xp6(5),e.hij(" ",t.locales.error,""),e.xp6(1),e.Q6J("innerHTML",t.formState.message,e.oJD)}}function Po(r,l){1&r&&e._UZ(0,"span",53)}function Ro(r,l){if(1&r&&(e.TgZ(0,"span",54),e._uU(1),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.Oqu(t.locales.loading)}}const Yo=function(r){return{width:r}},$o=function(r){return{"margin-top":r}},Qo=function(r){return{"is-invalid":r}};let Vo=(()=>
1{class r{constructor(t,s,i,o,a,d){this.activeModal=t,this.driverService=s,this.fb=i,this.http=o,this.hosService=a,this.utilService=d,this.onSubmit=new e.vpe,this.hide=!0,this.byteArr=[],this.inputTextLength=0,this.wrongFile=!1,this.wrongSize=!1,this.progress={percentage:"0%"}}ngOnInit(){this.moaForUser=this.hosService.moaForUser,this.loginUser=this.hosService.loginUser,this.documentForm=this.fb.group({docType:[{value:this.document.DriverDocTypeId,disabled:2===this.formType},[c.kI.required]],referenceId:[this.document.ReferenceId,[c.kI.required]],description:[this.document.Description,[c.kI.required]]}),1===this.formType?(this.DocType.setValue(null),this.inputTextLength=0):this.inputTextLength=this.Description.value.length}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close()}get DocType(){return this.documentForm.get("docType")}get ReferenceId(){return this.documentForm.get("referenceId")}get Description(){return this.documentForm.get("description")}onValueAdd(t,s){let i=t.trim();this.documentForm.get(`${s}`).setValue(i)}required(t){return this.documentForm.get(`${t}`).hasError("required")&&this.documentForm.get(`${t}`).touched}getRemainingText(){this.inputTextLength=this.Description.value.length}onFileSelected(t){if(this.documentForm.markAsDirty(),t.target.files[0])if(this.selectedFile=t.target.files[0],this.selectedFile.size/1024/1024>10)this.wrongFile=!1,this.wrongSize=!0,this.selectedFile=null,this.progress.percentage="0%",this.byteArr=[];else{let i=this.selectedFile.name.substring(this.selectedFile.name.lastIndexOf(".")+1);if(void 0===this.utilService.fileTypes[i])this.wrongFile=!0,this.wrongSize=!1,this.selectedFile=null,this.progress.percentage="0%",this.byteArr=[];else{this.wrongFile=!1,this.wrongSize=!1,this.progress.percentage="0%",this.byteArr=[],this.onUpload();let a=t.target.files,d=a[0];if(a&&d){let m=new FileReader;m.onload=this._handleReaderLoaded.bind(this),m.readAsArrayBuffer(d)}}}}_handleReaderLoaded(t){const s=new Uint8Array(t.target.result);for(let i=0;i<s.length;i++)this.byteArr.push(s[i])}onUpload(){this.progress.percentage=Math.round(100*this.selectedFile.size/this.selectedFile.size)+"%"}sendDocument(){let t="";this.documentForm.invalid&&(t+=this.locales.invalidForm+"<br>"),0===this.byteArr?.length&&1===this.formType&&(t+=this.locales.fileRequired+"<br>"),""!==t?this.formState={loading:!1,submited:!1,errors:!0,message:t}:this.onSubmit.emit({HOSDriverDocId:1===this.formType?0:this.document.HOSDriverDocId,HOSDriverId:this.driver.HOSDriverId,HOSClientId:this.driver.HOSClientId,HOSAccountId:this.moaForUser?.length>0?this.moaForUser[0].HOSAccountId:0,DriverDocTypeId:1===this.formType?+this.DocType.value:this.document.DriverDocTypeId,ReferenceId:this.ReferenceId.value,File:this.selectedFile?this.byteArr:null,FileName:this.selectedFile?this.selectedFile.name:null,Description:this.Description.value,HOSUserId:this.loginUser?this.loginUser.HOSUserId:1})}removeFile(){this.selectedFile=null,this.byteArr=[],this.progress.percentage="0%",this.myInputVariable.nativeElement.value=""}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(Le.F),e.Y36(c.QS),e.Y36(Je.eN),e.Y36(y.T),e.Y36(b.f))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-driver-doc-modal-form"]],viewQuery:function(s,i){if(1&s&&e.Gf(Do,5),2&s){let o;e.iGM(o=e.CRH())&&(i.myInputVariable=o.first)}},inputs:{locales:"locales",document:"document",formState:"formState",formType:"formType",driver:"driver",docTypes:"docTypes"},outputs:{onSubmit:"onSubmit"},decls:87,vars:44,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["id","driverDocForm","role","form","novalidate","",3,"formGroup","ngSubmit"],["ngbAutofocus","",1,"card-body"],[1,"card","border-dark","mb-3",2,"width","100%"],[1,"card-body","text-dark","my_card-body"],[1,"row"],[1,"col-md-6"],[1,"form-group"],[1,"col-6"],[1,"required-asterisk"],[1,"float-right"],["placement","left","tooltipClass","tooltip-color",1,"far","fa-question-circle",3,"ngbTooltip"],["bindLabel","label","bindValue","code","formControlName","docType",3,"items","clearable","placeholder"],["ng-option-tmp",""],["type","text","formControlName","referenceId","maxlength","30","required","",1,"form-control",3,"placeholder","change"],["id","number-error","class","error invalid-feedback",4,"ngIf"],[1,"col-md-12"],[1,"container","file-upload"],[1,"progress-container"],["class","required-asterisk",4,"ngIf"],[2,"float","right"],[1,"progress"],["role","progressbar","aria-valuemin","0","aria-valuemax","100",1,"progress-bar","bg-success",3,"ngStyle"],[2,"width","50px"],["type","file","accept","image/*,\n application/msword, \n application/vnd.ms-excel, \n application/vnd.ms-powerpoint,\n text/plain, \n text/csv, \n application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,\n application/vnd.openxmlformats-officedocument.presentationml.slideshow,\n application/vnd.openxmlformats-officedocument.presentationml.presentation,\n application/vnd.openxmlformats-officedocument.wordprocessingml.document,\n application/pdf",2,"display","none",3,"change"],["fileInput",""],[1,"fa","fa-upload","fa-lg",2,"cursor","pointer","margin-left","15px","color","#297be7",3,"ngStyle","title","click"],["class","fas fa-tras
1h-alt fa-lg","style","cursor: pointer; margin-top: 15px; margin-left: 15px; color:#297be7",3,"title","click",4,"ngIf"],["class","invalid-select",4,"ngIf"],[1,"row",2,"margin-top","15px"],["for","ruleset"],[1,"col-12"],["maxlength","150","formControlName","description",1,"form-control",3,"ngClass","placeholder","change","input"],[1,"remaining"],["class","error invalid-feedback",4,"ngIf"],["class","alert alert-danger alert-dismissible",4,"ngIf"],[1,"modal-footer"],["type","button",1,"btn","btn-primary",3,"disabled","click"],["class","spinner-border spinner-border-sm","role","status","aria-hidden","true",4,"ngIf"],["class","sr-only",4,"ngIf"],["type","button",1,"btn","btn-outline-dark",3,"click"],["id","number-error",1,"error","invalid-feedback"],[1,"fas","fa-trash-alt","fa-lg",2,"cursor","pointer","margin-top","15px","margin-left","15px","color","#297be7",3,"title","click"],[1,"invalid-select"],[1,"error","invalid-feedback"],[1,"alert","alert-danger","alert-dismissible"],["type","button","data-dismiss","alert","aria-hidden","true",1,"close"],[1,"icon","fas","fa-ban"],[3,"innerHTML"],["role","status","aria-hidden","true",1,"spinner-border","spinner-border-sm"],[1,"sr-only"]],template:function(s,i){if(1&s){const o=e.EpF();e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"form",5),e.NdJ("ngSubmit",function(){return i.sendDocument()}),e.TgZ(8,"div",6)(9,"div",7)(10,"div",8)(11,"div",9)(12,"div",10)(13,"div",11)(14,"div",9)(15,"div",12)(16,"label"),e._uU(17),e.qZA(),e.TgZ(18,"span",13),e._uU(19,"*"),e.qZA()(),e.TgZ(20,"div",12)(21,"span",14),e._UZ(22,"i",15),e.qZA()()(),e.TgZ(23,"ng-select",16),e.YNc(24,Fo,1,1,"ng-template",17),e.qZA()()(),e.TgZ(25,"div",10)(26,"div",11)(27,"div",9)(28,"div",12)(29,"label"),e._uU(30),e.qZA(),e.TgZ(31,"span",13),e._uU(32,"*"),e.qZA()(),e.TgZ(33,"div",12)(34,"span",14),e._UZ(35,"i",15),e.qZA()()(),e.TgZ(36,"input",18),e.NdJ("change",function(d){return i.onValueAdd(d.target.value,"referenceId")}),e.qZA(),e.YNc(37,Mo,2,1,"span",19),e.qZA()()(),e.TgZ(38,"div",9)(39,"div",20)(40,"div",21)(41,"div",22)(42,"label"),e._uU(43),e.qZA(),e.YNc(44,ko,2,0,"span",23),e.TgZ(45,"span",24),e._uU(46),e.qZA(),e.TgZ(47,"div",25),e._UZ(48,"div",26),e.qZA(),e.TgZ(49,"p"),e._uU(50),e.TgZ(51,"span",24),e._uU(52),e.qZA()()(),e.TgZ(53,"div",27)(54,"input",28,29),e.NdJ("change",function(d){return i.onFileSelected(d)}),e.qZA(),e.TgZ(56,"i",30),e.NdJ("click",function(){e.CHM(o);const d=e.MAs(55);return e.KtG(d.click())}),e.qZA(),e.YNc(57,qo,1,1,"i",31),e.qZA()(),e.YNc(58,Lo,2,1,"span",32),e.YNc(59,Jo,2,1,"span",32),e.qZA()(),e.TgZ(60,"div",33)(61,"div",20)(62,"div",11)(63,"div",9)(64,"div",12)(65,"label",34),e._uU(66),e.qZA(),e.TgZ(67,"span",13),e._uU(68,"*"),e.qZA()(),e.TgZ(69,"div",12)(70,"span",14),e._UZ(71,"i",15),e.qZA()()(),e.TgZ(72,"div",9)(73,"div",35)(74,"textarea",36),e.NdJ("change",function(d){return i.onValueAdd(d.target.value,"description")})("input",function(){return i.getRemainingText()}),e._uU(75," "),e.qZA(),e.TgZ(76,"span",37),e._uU(77),e.qZA(),e.YNc(78,Bo,2,1,"span",38),e.qZA()()()()(),e.YNc(79,Eo,7,2,"div",39),e.qZA()()()()(),e.TgZ(80,"div",40)(81,"button",41),e.NdJ("click",function(){return i.sendDocument()}),e.YNc(82,Po,1,0,"span",42),e.YNc(83,Ro,2,1,"span",43),e._uU(84),e.qZA(),e.TgZ(85,"button",44),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(86),e.qZA()()}2&s&&(e.xp6(2),e.Oqu(1===i.formType?i.locales.addDocument:i.locales.editDocument),e.xp6(5),e.Q6J("formGroup",i.documentForm),e.xp6(10),e.Oqu(i.locales.docType),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.s9C("placeholder",i.locales.selectDocType),e.Q6J("items",i.docTypes)("clearable",!1),e.xp6(7),e.Oqu(i.locales.referenceId),e.xp6(5),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(1),e.ekj("is-invalid",(null==i.ReferenceId?null:i.ReferenceId.errors)&&(i.ReferenceId.touched||2===i.formType)),e.s9C("placeholder",i.locales.referenceId),e.xp6(1),e.Q6J("ngIf",i.required("referenceId")),e.xp6(3),e.Udp("border",i.wrongFile||i.wrongSize?"2px dashed rgb(222, 51, 51)":"2px dashed rgb(222, 226, 221)"),e.xp6(3),e.Oqu(i.locales.file),e.xp6(1),e.Q6J("ngIf",1===i.formType),e.xp6(2),e.Oqu(i.progress.percentage),e.xp6(2),e.Q6J("ngStyle",e.VKq(38,Yo,i.progress.percentage)),e.xp6(2),e.hij("",i.locales.fileName,": "),e.xp6(2),e.Oqu(i.selectedFile?i.selectedFile.name:""),e.xp6(4),e.s9C("title",i.locales.uploadFile),e.Q6J("ngStyle",e.VKq(40,$o,(null==i.byteArr?null:i.byteArr.length)>0?"15px":"35px")),e.xp6(1),e.Q6J("ngIf",(null==i.byteArr?null:i.byteArr.length)>0),e.xp6(1),e.Q6J("ngIf",i.wrongFile),e.xp6(1),e.Q6J("ngIf",i.wrongSize),e.xp6(7),e.Oqu(i.locales.description),e.xp6(
15),e.MGl("ngbTooltip","",i.locales.required,"."),e.xp6(3),e.s9C("placeholder",i.locales.description),e.Q6J("ngClass",e.VKq(42,Qo,(null==i.Description?null:i.Description.errors)&&(i.Description.touched||2===i.formType))),e.xp6(3),e.hij("",i.inputTextLength," / 150"),e.xp6(1),e.Q6J("ngIf",i.required("description")),e.xp6(1),e.Q6J("ngIf",i.formState.errors),e.xp6(2),e.Q6J("disabled",i.documentForm.invalid||i.formState.loading||!i.documentForm.dirty||1===i.formType&&0===i.byteArr.length),e.xp6(1),e.Q6J("ngIf",i.formState.loading),e.xp6(1),e.Q6J("ngIf",i.formState.loading),e.xp6(1),e.hij(" ",i.locales.save," "),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.mk,Q.O5,Q.PC,P._L,c._Y,c.Fj,c.JJ,c.JL,c.Q7,c.nD,c.sg,c.u,Be.w9,Be.ir],styles:['.container[_ngcontent-%COMP%]{background:#FFFFFF;margin-top:20px;height:90px;border:2px dashed rgb(222,226,221);border-radius:5px;width:100%}.container[_ngcontent-%COMP%]:after{content:"";display:table;clear:both}.container[_ngcontent-%COMP%] .progress-container[_ngcontent-%COMP%]{float:left;margin-right:auto;width:93%}.container[_ngcontent-%COMP%] div[_ngcontent-%COMP%]:last-child{float:right;width:5%;background-color:#e9e6e6;height:100%;border-radius:5px;margin-right:-8px}.progress[_ngcontent-%COMP%]{margin-top:auto;height:.5rem!important;width:100%}hr[_ngcontent-%COMP%]{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}']})}return r})();var Mt=F(65226);function Wo(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.uploadEditDriverDoc(i.data))}),e._UZ(1,"i",28),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.editDocument)}}function zo(r,l){1&r&&e._UZ(0,"button",29)}function jo(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.deleteDocument(i.data))}),e._UZ(1,"i",30),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.deleteDocument)}}function Go(r,l){1&r&&e._UZ(0,"button",29)}function Ko(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"button",24),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.downloadFile(o.data))}),e._UZ(2,"i",25),e.qZA(),e.YNc(3,Wo,2,1,"button",26),e.YNc(4,zo,1,0,"button",27),e.YNc(5,jo,2,1,"button",26),e.YNc(6,Go,1,0,"button",27),e.qZA()}if(2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.s9C("title",s.locales.downloadFile),e.xp6(2),e.Q6J("ngIf",t.data.LastUpdatedHOSUserId>0),e.xp6(1),e.Q6J("ngIf",!(t.data.LastUpdatedHOSUserId>0)),e.xp6(1),e.Q6J("ngIf",t.data.LastUpdatedHOSUserId>0),e.xp6(1),e.Q6J("ngIf",!(t.data.LastUpdatedHOSUserId>0))}}function Xo(r,l){if(1&r&&(e.TgZ(0,"div"),e._uU(1),e.qZA()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.hij(" ",s.getDocType(t.data)," ")}}let en=(()=>{class r{constructor(t,s,i,o,a,d,m,v){this.activeModal=t,this.modalService=s,this.driverService=i,this.eventBus=o,this.toast=a,this.utilService=d,this.confirmDialogService=m,this.hosService=v,this.docTypes=[]}ngOnInit(){this.loginUser=this.hosService.loginUser,this.docTypes=this.driverService.docTypes,this.docTypes[0].label=this.locales.accidentPhoto,this.docTypes[1].label=this.locales.billOfLadind,this.docTypes[2].label=this.locales.citation,this.docTypes[3].label=this.locales.scaleTicket,this.docTypes[4].label=this.locales.invoice,this.docTypes[5].label=this.locales.proofOfCorrection,this.docTypes[6].label=this.locales.otherEnum}uploadEditDriverDoc(t){let i=t?2:1;const o=this.modalService.open(Vo,{size:"lg",scrollable:!0});o.componentInstance.locales={...this.locales},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!1,errors:!1,message:""}))),o.componentInstance.document=1===i?this.driverService.pristineDoc():JSON.parse(JSON.stringify(t)),o.componentInstance.formType=i,o.componentInstance.driver=this.driver,o.componentInstance.docTypes=this.docTypes;const a=o.componentInstance.onSubmit.subscribe(d=>{let m={loading:!0,submited:!1,errors:!1,message:""};o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(m))),this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverService.uploadEditDriverDoc(d).subscribe(v=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:Z}=v.d;1===Z?(this.toast.success(1===i?this.locales.added_successfully:this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),m={loading:!1,submited:!0,errors:!1,message:""},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(m))),this.getDriverDocuments()):(m={loading:!1,submited:!0,errors:!0,message:1===i?this.locales.error_trying_save:this.locales.error_trying_update},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(m))))},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),m={loading:!1,submited:!0,errors:!0,message:this.locales.error500},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(m)))})});o.result.finally(()=>a.unsubscribe())}getDriverDocuments(){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverService.getDriverDocuments(this.driver.HOSDriverId).subscribe(t=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:s,data:i}=t.d;this.driverDocs=1===s?[...i]:[]},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.driverDocs=[]})}downloadFileOld(t){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverService.getDocFile(t.HOSDriverDocId,this.driver.HOSDriverId).subscribe(s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:i,data:o}=s.d;if(1===i)if(o?.length>0){let a=new Uint8Array(o),d=t.FileName.substring(t.FileName.lastIndexOf(".")+1),v=new Blob([a],{type:this.utilService.fileTypes[d]||"application/pdf"});(0,Mt.saveAs)(v,t.FileName)}else this.toast.error(this.locales.errorDownload,{style:this.utilService.errorStyleMsg,duration:4e3,dismissible:!0});else this.toast.error(this.locales.errorDownload,{style:this.utilService.errorStyleMsg,duration:4e3,dismissible:!0})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0})})}downloadFile(t){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverService.getDocURL(t.HOSDriverId,t.HOSDriverDocId).subscribe(s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:i,data:o}=s.d;1===i?o?.length>0?window.open(o):this.toast.error(this.locales.fileNotFound,{style:this.utilService.errorStyleMsg,duration:4e3,dismissible:!0}):this.toast.error(this.locales.errorDownload,{style:this.utilService.errorStyleMsg,duration:4e3,dismissible:!0})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0})})}deleteDocument(t){this.confirmDialogService.confirm(this.locales.pleaseConfirm,this.locales.askDeleteDocument+t.FileName+"?").then(s=>{s&&(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverService.deleteDocFile(this.loginUser?this.loginUser.HOSUserId:1,t.HOSDriverDocId).subscribe(i=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:o}=i.d;1===o?(this.toast.success(this.locales.deleted_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),this.getDriverDocuments()):this.toast.error(this.locales.error_trying_delete,{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0})}
1))}).catch(()=>console.log())}getDocType(t){const s=this.docTypes.find(i=>i.code===t.DriverDocTypeId);return s?s.label:""}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(P.FF),e.Y36(Le.F),e.Y36(n.Yd),e.Y36(N.jE),e.Y36(b.f),e.Y36(S.O),e.Y36(y.T))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-doc-list"]],inputs:{driverDocs:"driverDocs",locales:"locales",driver:"driver"},decls:29,vars:22,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],[1,"card","card-default"],[1,"card-header"],[1,"card-tools"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],[1,"card-body"],["id","gridContainer",3,"columnAutoWidth","dataSource","showBorders","columnHidingEnabled"],[3,"visible","placeholder"],[3,"pageSize"],[3,"enabled"],["dataField","FileName",3,"caption"],["dataField","ReferenceId",3,"caption"],["dataField","DriverDocTypeId","dataType","string","cellTemplate","docTypeTemplate",3,"caption"],["dataField","Location",3,"caption"],["dataField","Description",3,"caption"],["cellTemplate","actionsTemplate","dataType","boolean",3,"width","caption"],[4,"dxTemplate","dxTemplateOf"],[1,"modal-footer"],["type","button",1,"btn","btn-outline-dark",3,"click"],["type","button",1,"btn","btn-link",3,"title","click"],[1,"fa","fa-download"],["type","button","class","btn btn-link",3,"title","click",4,"ngIf"],["type","button","class","btn btn-link no-button",4,"ngIf"],[1,"fas","fa-edit"],["type","button",1,"btn","btn-link","no-button"],[1,"fas","fa-trash-alt"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"div",5)(8,"div",6)(9,"div",7)(10,"button",8),e.NdJ("click",function(){return i.uploadEditDriverDoc()}),e._UZ(11,"i",9),e._uU(12),e.qZA()()(),e.TgZ(13,"div",10)(14,"dx-data-grid",11),e._UZ(15,"dxo-search-panel",12)(16,"dxo-paging",13)(17,"dxo-load-panel",14)(18,"dxi-column",15)(19,"dxi-column",16)(20,"dxi-column",17)(21,"dxi-column",18)(22,"dxi-column",19)(23,"dxi-column",20),e.YNc(24,Ko,7,5,"div",21),e.YNc(25,Xo,2,1,"div",21),e.qZA()()()(),e.TgZ(26,"div",22)(27,"button",23),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(28),e.qZA()()),2&s&&(e.xp6(2),e.lnq("",i.locales.driverDocuments," (",i.driver.LastName,", ",i.driver.Name,")"),e.xp6(10),e.hij(" ",i.locales.newItem," "),e.xp6(2),e.Q6J("columnAutoWidth",!0)("dataSource",i.driverDocs)("showBorders",!0)("columnHidingEnabled",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize",10),e.xp6(1),e.Q6J("enabled",!1),e.xp6(1),e.s9C("caption",i.locales.fileName),e.xp6(1),e.s9C("caption",i.locales.referenceId),e.xp6(1),e.s9C("caption",i.locales.docType),e.xp6(1),e.s9C("caption",i.locales.location),e.xp6(1),e.s9C("caption",i.locales.description),e.xp6(1),e.s9C("caption",i.locales.actions),e.Q6J("width",150),e.xp6(1),e.Q6J("dxTemplateOf","actionsTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","docTypeTemplate"),e.xp6(3),e.Oqu(i.locales.close))},dependencies:[Q.O5,Se.e,ee.qvW,ee.mKI,ee.sXh,ee.XXE,pe.p6],styles:[".dx-datagrid-content .dx-datagrid-table .dx-row>td, .dx-datagrid-content[_ngcontent-%COMP%] .dx-datagrid-table[_ngcontent-%COMP%] .dx-row[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{vertical-align:inherit!important} .dx-datagrid-headers .dx-datagrid-table .dx-row.dx-header-row td{background-color:#e9ecef!important;color:#000!important;font-weight:600!important}"]})}return r})();var tn=F(58459),sn=F(43015),rn=F.n(sn),on=F(34498),nn=F(53755);let an=(()=>{class r{constructor(t){this.activeModal=t,this.onProceed=new e.vpe}ngDoCheck(){this.closeForceUploadLogsDialog&&this.activeModal.close()}proceed(){this.onProceed.emit({proceed:!0})}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-force-upload-logs-modal"]],inputs:{message:"message",closeForceUploadLogsDialog:"closeForceUploadLogsDialog"},outputs:{onProceed:"onProceed"},decls:12,vars:1,consts:[[1,"modal-header"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"dialog-body"],[1,"card-body"],[1,"modal-footer"],["type","button",1,"btn","btn-primary",3,"click"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"button",1),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(2,"span",2),e._uU(3,"\xd7"),e.qZA()()(),e.TgZ(4,"div",3)(5,"div",4)(6,"div")(7,"p"),e._uU(8),e.qZA()()()(),e.TgZ(9,"div",5)(10,"button",6),e.NdJ("click",function(){return i.proceed()}),e._uU(11,"Proceed"),e.qZA()()),2&s&&(e.xp6(8),e.Oqu(i.message))}})}return r})(),kt=(()=>
1{class r{constructor(t){this.activeModal=t,this.onStatusChange=new e.vpe}ngDoCheck(){this.formState&&this.formState.submited&&!this.formState.errors&&this.activeModal.close()}confirm(){localStorage.setItem("statusChangeConfirmed","yes"),this.onStatusChange.emit(!0)}dismiss(){this.activeModal.dismiss(),localStorage.setItem("statusChangeConfirmed","yes")}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-confirm-status-change-dialog"]],inputs:{formState:"formState"},outputs:{onStatusChange:"onStatusChange"},decls:15,vars:0,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["ngbAutofocus","",1,"card-body"],[1,"modal-footer"],["type","button",1,"btn","btn-outline-dark",3,"click"],["type","button",1,"btn","btn-primary",3,"click"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2,"Warning!"),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"div",5)(8,"p"),e._uU(9,"This change may impact the upcoming billing report and invoice."),e.qZA()()(),e.TgZ(10,"div",6)(11,"button",7),e.NdJ("click",function(){return i.dismiss()}),e._uU(12,"Close"),e.qZA(),e.TgZ(13,"button",8),e.NdJ("click",function(){return i.confirm()}),e._uU(14,"Proceed"),e.qZA()())}})}return r})();var mt=F(40136),Ee=F(34509),Me=F(23364);let qt=(()=>{class r{transform(t){return t.LastName?`${t.LastName}, ${t.Name}`:`${t.Name}`}static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275pipe=e.Yjl({name:"driverName",type:r,pure:!0})}return r})();function ln(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",28)(1,"button",29),e._UZ(2,"i",30),e._uU(3),e.qZA(),e.TgZ(4,"div",31)(5,"a",32),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.exportDriversPDF())}),e._UZ(6,"i",33),e._uU(7,"\xa0\xa0PDF"),e.qZA(),e.TgZ(8,"a",32),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.exportDriverExcel())}),e._UZ(9,"i",34),e._uU(10,"\xa0\xa0XLS"),e.qZA()()()}if(2&r){const t=e.oxw();e.xp6(3),e.hij(" ",t.locales.download," ")}}function cn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",35),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.addDriver())}),e._UZ(1,"i",36),e._uU(2),e.qZA()}if(2&r){const t=e.oxw();e.xp6(2),e.hij(" ",t.locales.newItem," ")}}function dn(r,l){1&r&&e._UZ(0,"dxi-column",37)}function mn(r,l){if(1&r&&e._UZ(0,"dxi-column",38),2&r){const t=e.oxw();e.s9C("caption",t.locales.carrier)}}function un(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.ALo(3,"driverName"),e.qZA()()),2&r){const t=l.$implicit;e.xp6(2),e.Oqu(e.lcZ(3,1,t.data))}}function hn(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(2),e.Oqu(s.getCarrierName(t.data.HOSClientId))}}function pn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",39)(1,"dx-check-box",40),e.NdJ("onValueChanged",function(i){const a=e.CHM(t).$implicit,d=e.oxw();return e.KtG(d.activedDriver(i,a.data))}),e.qZA()()}if(2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.Q6J("value",t.data.IsActive)("disabled",1===s.roleHOS&&!s.enableByRole&&!t.data.IsActive&&1!==(null==t.data?null:t.data.ActivateDriver)||1!=s.roleHOS&&!s.enableByRole&&!t.data.IsActive&&!(null!=s.carrier&&s.carrier.ActivateDriver)||1===s.roleHOS&&0===t.data.HOSDriverId||6===s.driverPermission&&s.loginUser&&6!==s.loginUser.HOSUserTypeId)}}function fn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",41),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.unlockDriver(i.data))}),e._UZ(1,"i",46),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.unlock)}}function gn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",41),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.sendNotification(i.data))}),e._UZ(1,"i",47),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.send_notification)}}function vn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",41),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.getDriverDocuments(i.data))}),e._UZ(1,"i",48),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.driverDocuments)}}function _n(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",41),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.openECMLogData(i.data))}),e._UZ(1,"i",49),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.ecmData)}}function Sn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",50),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.initiateLogs(i.data))}),e._UZ(1,"i",51),e.qZA()}}function bn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",52),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.stopLogs(i.data))}),e._UZ(1,"i",53),e.qZA()}}function Cn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",41),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.getLogsHistory(i.data))}),e._UZ(1,"i",54),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.logsHistory)}}function Tn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",39)(1,"button",41),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.openDriverForm(o.data))}),e._UZ(2,"i",42),e.qZA(),e.YNc(3,fn,2,1,"button",43),e.YNc(4,gn,2,1,"button",43),e.YNc(5,vn,2,1,"button",43),e.YNc(6,_n,2,1,"button",43),e.YNc(7,Sn,2,0,"button",44),e.YNc(8,bn,2,0,"button",45),e.YNc(9,Cn,2,1,"button",43),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.locales.drivers_details),e.xp6(2),e.Q6J("ngIf",5===t.driverPermission&&t.loginUser||!t.loginUser||t.loginUser&&(6===t.loginUser.HOSUserTypeId||7===t.loginUser.HOSUserTypeId)),e.xp6(1),e.Q6J("ngIf",t.enableByRole&&(5===t.driverPermission&&t.loginUser||!t.loginUser||t.loginUser&&(6===t.loginUser.HOSUserTypeId||7===t.loginUser.HOSUserTypeId))),e.xp6(1),e.Q6J("ngIf",5===t.driverPermission&&t.loginUser||!t.loginUser||t.loginUser&&(6===t.loginUser.HOSUserTypeId||7===t.loginUser.HOSUserTypeId)),e.xp6(1),e.Q6J("ngIf",3===t.role),e.xp6(1),e.Q6J("ngIf",t.loginUser&&6===t.loginUser.HOSUserTypeId),e.xp6(1),e.Q6J("ngIf",t.loginUser&&6===t.loginUser.HOSUserTypeId),e.xp6(1),e.Q6J("ngIf",t.loginUser&&6===t.loginUser.HOSUserTypeId)}}function yn(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(2),e.Oqu(s.getHomeBaseName(t.data.HOSHomeBaseId))}}const Lt=function(){return{standalone:!0}},An=function(r,l){return{icon:"refresh",onClick:r,hint:l}};let Jt=(()=>
1{class r{constructor(t,s,i,o,a,d,m,v,Z,H){this.modalService=t,this.administrationService=s,this.eventBus=i,this.hosService=o,this.authService=a,this.toast=d,this.homeBaseService=m,this.driverService=v,this.utilService=Z,this.db=H,this.onActivate=new e.vpe,this.onSendNotification=new e.vpe,this.onDeleteDriver=new e.vpe,this.onSendDriver=new e.vpe,this.onDriverAdd=new e.vpe,this.onUnLockDriver=new e.vpe,this.refreshDriverData=new e.vpe,this.driversCopy=[],this.loading=!1,this.homeBases=[],this.driversFilter=[],this.selectedDriver=-1,this.driverListSub=new V.w,this.refreshData=()=>{this.refreshDriverData.emit({action:"drivers",itemData:this.hosService.currentCarrier,moa:this.moaForUser,fetchLatest:!0})}}ngOnInit(){this.loginUser=this.hosService.loginUser,this.roleHOS=this.authService.appCredentials.role,this.partnerId=this.authService.appCredentials.partnerId,this.moaForUser=this.hosService.moaForUser,this.loginUser&&this.getDriverModelPermission(),this.driversFilter=[{label:this.locales.all,code:-1},{label:this.locales.active,code:1},{label:this.locales.inactive,code:0}]}ngOnChanges(t){if(this.hosService.homeBasesAdmin&&(this.homeBases=[...this.hosService.homeBasesAdmin],void 0===this.homeBases.find(i=>-1===i.HOSHomeBaseId))){const i=this.homeBaseService.getPristineHomeBase();i.Name=this.locales.allHomeBases,this.homeBases=[i,...this.hosService.homeBasesAdmin]}this.drivers&&(this.driversCopy=[...this.drivers],this.selectedHomeBase=null,this.selectedDriver=-1,this.driversFilter=[{label:`${this.locales.all} (${this.drivers.length})`,code:-1},{label:`${this.locales.active} (${this.drivers.filter(s=>1===s.IsActive).length})`,code:1},{label:`${this.locales.inactive} (${this.drivers.filter(s=>0===s.IsActive).length})`,code:0}])}ngOnDestroy(){this.driverListSub.unsubscribe(),this.deviceLogsSub&&this.deviceLogsSub.off(),this.logsTimeout&&clearTimeout(this.logsTimeout),this.systemlevelStopLogsSub&&this.systemlevelStopLogsSub.off(),this.resellerlevelStopLogsSub&&this.resellerlevelStopLogsSub.off(),this.carrierlevelStopLogsSub&&this.carrierlevelStopLogsSub.off(),this.driverlevelStopLogsSub&&this.driverlevelStopLogsSub.off()}addDriver(){this.onDriverAdd.emit(this.driverPermission)}getDriverModelPermission(){this.driverPermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>5===s)?5:6}get enableByRole(){return 2===this.role||3===this.role||4===this.role}activedDriver(t,s){const i=s.IsActive,o=+t.value;let a={loading:!1,submited:!1,errors:!1,message:""};const{CountMode:d=0}=this.authService?.appReseller,m=localStorage.getItem("statusChangeConfirmed")||"no";if(1!==d&&2!==d||!m||"yes"===m)this.onActivate.emit({active:o,HOSDriverId:s.HOSDriverId,index:s.index});else{const v=this.modalService.open(kt,{scrollable:!0,size:"md"});v.componentInstance&&(v.componentInstance.formState=JSON.parse(JSON.stringify(a))),v.componentInstance.onStatusChange.subscribe(Z=>{Z&&this.onActivate.emit({active:o,HOSDriverId:s.HOSDriverId,index:s.index}),a={loading:!1,submited:!0,errors:!1,message:""},v.componentInstance&&(v.componentInstance.formState=JSON.parse(JSON.stringify(a)))}),v.result.catch(()=>{s.IsActive=i,this.dataGrid.instance.refresh()})}}sendNotification(t){this.onSendNotification.emit(t)}onDelete(t){this.onDeleteDriver.emit(t)}openDriverForm(t){this.onSendDriver.emit({driver:t,driverPermission:this.driverPermission,disabledActivateDriver:!(this.loginUser?.isSynthetic&&1!==this.roleHOS)&&(!this.enableByRole&&!t.IsActive&&!this.carrier?.ActivateDriver&&!(9===this.loginUser?.HOSUserTypeId||10===this.loginUser?.HOSUserTypeId)||1===this.roleHOS&&0===t.HOSDriverId||6===this.driverPermission&&this.loginUser&&6!==this.loginUser.HOSUserTypeId)})}getHomeBaseName(t){if(this.hosService.homeBasesAdmin&&this.hosService.homeBasesAdmin.length>0){let s=this.hosService.homeBasesAdmin.find(i=>i.HOSHomeBaseId===t);return s?s.Name:this.locales.noHomeBase}return this.locales.noHomeBase}openECMLogData(t){const i=this.modalService.open(Ft,{size:"md",scrollable:!0});i.componentInstance.ecmLogData=new Ht,i.componentInstance.locales=this.locales,i.componentInstance.driver=t,i.componentInstance.carrier=this.carrier,i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!1,errors:!1,message:""})));const o=i.componentInstance.onSubmit.subscribe(a=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverListSub.add(this.administrationService.SendHOSLogECMPushNotification(a).subscribe(d=>{1===d.d?(i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!1,message:""}))),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.success(this.locales.ecmDataSendOK,{style:this.utilService.successStyleMsg,duration:3e3,dismissible:!0})):(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!0,message:this.locales.ecmDataSendError}))))},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!0,message:this.locales.error500})))}))});i.result.finally(()=>o.unsubscribe())}unlockDriver(t){this.onUnLockDriver.emit(t.HOSDriverId)}getCarrierName(t){if(this.hosService.moaForUser?.length>0){const s=this.hosService.moaForUser[0].HOSClients,i=s.findIndex(o=>o.HOSClientId===t);return-1!==i?s[i].Name:""}return""}homeBaseChange(t){switch(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driversCopy?.length>0&&(this.drivers=[...this.driversCopy]),t.value){case void 0:case null:case 0:this.drivers=[...this.driversCopy];break;default:this.drivers=this.driversCopy.filter(s=>s.HOSHomeBaseId===t.value)}(0===this.selectedDriver||1===this.selectedDriver)&&(this.drivers=this.drivers.filter(s=>s.IsActive===this.selectedDriver)),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}driversFilterChange(t){switch(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driversCopy?.length>0&&(this.drivers=[...this.driversCopy]),t.value){case void 0:case null:case-1:this.drivers=[...this.driversCopy];break;default:this.drivers=this.driversCopy.filter(s=>s.IsActive===t.value)}this.selectedHomeBase>0&&(this.drivers=this.drivers.filter(s=>s.HOSHomeBaseId===this.selectedHomeBase)),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}getDriverDocuments(t){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverService.getDriverDocuments(t.HOSDriverId).subscribe(s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:i,data:o}=s.d;let a=[];1===i&&(a=[...o]);const d=this.modalService.open(en,{windowClass:"modal-size-document",scrollable:!0});d.componentInstance.driverDocs=JSON.parse(JSON.stringify(a)),d.componentInstance.locales=this.locales,d.componentInstance.driver=t},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))})}
1exportDriversPDF(){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),setTimeout(()=>{const t=new tn.default("l");let s=[],i=[];this.moaForUser?.length>0?(s=[[this.locales.name,this.locales.username,this.locales.carrier,this.locales.home_base,this.locales.ruleset,this.locales.active,this.locales.personal,this.locales.yard,this.locales.registration_state,this.locales.license_number]],this.drivers.forEach(o=>{i.push([`${o.LastName}, ${o.Name}`,o.HOSUserName,this.getCarrierName(o.HOSClientId),this.getHomeBaseName(o.HOSHomeBaseId),this.getRulesetName(o.HOSRuleSetId),1===o.IsActive?this.locales.yes:this.locales.no,1===o.PersonalUse?this.locales.yes:this.locales.no,1===o.YardMove?this.locales.yes:this.locales.no,o.LicenseState,o.LicenseNumber])})):(s=[[this.locales.name,this.locales.username,this.locales.home_base,this.locales.ruleset,this.locales.active,this.locales.personal,this.locales.yard,this.locales.registration_state,this.locales.license_number]],this.drivers.forEach(o=>{i.push([`${o.LastName}, ${o.Name}`,o.HOSUserName,this.getHomeBaseName(o.HOSHomeBaseId),this.getRulesetName(o.HOSRuleSetId),1===o.IsActive?this.locales.yes:this.locales.no,1===o.PersonalUse?this.locales.yes:this.locales.no,1===o.YardMove?this.locales.yes:this.locales.no,o.LicenseState,o.LicenseNumber])})),rn()(t,{head:s,body:i,margin:{top:30},headStyles:{fillColor:[255,255,255],textColor:[140,140,140],lineWidth:.05,fontStyle:"normal"},theme:"grid",didDrawCell:o=>{},didDrawPage:o=>{let a=t.getNumberOfPages();for(let d=1;d<=a;d++){if(t.setFontSize(20),t.setTextColor(40),t.text(this.locales.drivers,o.settings.margin.left,10),this.moaForUser?.length>0)t.setFontSize(15),t.setTextColor(40),t.text(`MOA: ${this.moaForUser[0].HOSAccountName}`,o.settings.margin.left,20);else{t.setFontSize(15),t.setTextColor(40);const v=`${this.locales.dotnscNumber}: ${this.carrier.CarrierId}`;t.text(`${this.locales.carrier}: ${this.carrier.CarrierName}`,o.settings.margin.left,20),t.text(v,t.internal.pageSize.getWidth()-80,20)}t.setPage(d),t.setFontSize(10),t.setTextColor(150),t.text(this.locales.page+" "+d,t.internal.pageSize.getWidth()-25,t.internal.pageSize.getHeight()-10)}}}),t.save("DriverList.pdf"),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))},1e3)}exportDriverExcel(){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),setTimeout(()=>{let t=[],s=[];t=this.moaForUser?.length>0?[this.locales.name,this.locales.username,this.locales.carrier,this.locales.home_base,this.locales.ruleset,this.locales.active,this.locales.personal,this.locales.yard,this.locales.registration_state,this.locales.license_number]:[this.locales.name,this.locales.username,this.locales.home_base,this.locales.ruleset,this.locales.active,this.locales.personal,this.locales.yard,this.locales.registration_state,this.locales.license_number];let i=new on.Workbook,o=i.addWorksheet("DriverList");if(o.autoFilter=this.moaForUser?.length>0?"A4:J4":"A4:I4",o.views=[{state:"frozen",xSplit:0,ySplit:4}],o.getCell("A1").value=this.locales.drivers,o.mergeCells(this.moaForUser?.length>0?"A1:J1":"A1:I1"),o.getCell("A1").font={size:20},this.moaForUser?.length>0){const d=`MOA: ${this.moaForUser[0].HOSAccountName}`;o.getCell("A2").value=d,o.mergeCells("A2:K2")}else{const d=`${this.locales.carrier}: ${this.carrier.CarrierName}`,m=`${this.locales.dotnscNumber}: ${this.carrier.CarrierId}`;o.getCell("A2").value=d,o.mergeCells("A2:F2"),o.getCell("H2").value=m,o.mergeCells("H2:I2")}o.addRow([]),o.addRow(t).eachCell((d,m)=>{o.getColumn(m).width=t[m-1].length<20?20:t[m-1].length}),this.drivers.forEach(d=>{s=this.moaForUser?.length>0?[`${d.LastName}, ${d.Name}`,d.HOSUserName,this.getCarrierName(d.HOSClientId),this.getHomeBaseName(d.HOSHomeBaseId),this.getRulesetName(d.HOSRuleSetId),1===d.IsActive?this.locales.yes:this.locales.no,1===d.PersonalUse?this.locales.yes:this.locales.no,1===d.YardMove?this.locales.yes:this.locales.no,d.LicenseState,d.LicenseNumber]:[`${d.LastName}, ${d.Name}`,d.HOSUserName,this.getHomeBaseName(d.HOSHomeBaseId),this.getRulesetName(d.HOSRuleSetId),1===d.IsActive?this.locales.yes:this.locales.no,1===d.PersonalUse?this.locales.yes:this.locales.no,1===d.YardMove?this.locales.yes:this.locales.no,d.LicenseState,d.LicenseNumber],o.addRow(s)}),i.xlsx.writeBuffer().then(d=>{(0,Mt.saveAs)(new Blob([d],{type:"application/octet-stream"}),"DriverList.xlsx"),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))})},1e3)}getRulesetName(t){const s=this.utilService.ruleSets.find(i=>i.key===t);return s?s.label:""}initiateLogs(t){this.readRTDB(t.HOSClientId,t)}readRTDB(t,s){this.systemlevelStopLogsSub=this.db.database.ref("LOGS/STOP_UPLOAD_LOGS/All/System"),this.resellerlevelStopLogsSub=this.db.database.ref(`LOGS/STOP_UPLOAD_LOGS/Reseller/${this.carrier.HOSBillingId}`),this.carrierlevelStopLogsSub=this.db.database.ref(`LOGS/STOP_UPLOAD_LOGS/Carrier/${t}`),this.driverlevelStopLogsSub=this.db.database.ref(`LOGS/${s.HOSDriverId}`),this.listenToSystemLevelStopLogs(s)}listenToSystemLevelStopLogs(t){let s,i;this.systemlevelStopLogsSub&&this.systemlevelStopLogsSub.off(),this.systemlevelStopLogsSub.on("value",o=>{const a=o.val(),{stopUploadLogsUntil:d=0,timeStamp:m=0}=a||{},v=this.utilService.isDurationCompleted(m,d);a?v?(this.systemlevelStopLogsSub&&this.systemlevelStopLogsSub.off(),this.listenToResellerLevelStopLogs(t)):(i=this.utilService.getCompletionTime(m,d),this.systemlevelStopLogsSub&&this.systemlevelStopLogsSub.off(),s=`Logs have stopped uploading at the system level until ${i}. Would you like to force upload the log?`,this.openDialog(s,t)):this.listenToResellerLevelStopLogs(t)})}listenToResellerLevelStopLogs(t){let s,i;this.resellerlevelStopLogsSub&&this.resellerlevelStopLogsSub.off(),this.resellerlevelStopLogsSub.on("value",o=>{const a=o.val(),{stopUploadLogsUntil:d=0,timeStamp:m=0}=a||{},v=this.utilService.isDurationCompleted(m,d);a?v?(this.resellerlevelStopLogsSub&&this.resellerlevelStopLogsSub.off(),this.listenToCarrierLevelStopLogs(t)):(i=this.utilService.getCompletionTime(m,d),this.resellerlevelStopLogsSub&&this.resellerlevelStopLogsSub.off(),s=`Logs have stopped uploading at the reseller level until ${i}. Would you like to force upload the log?`,this.openDialog(s,t)):(this.resellerlevelStopLogsSub&&this.resellerlevelStopLogsSub.off(),this.listenToCarrierLevelStopLogs(t))})}listenToCarrierLevelStopLogs(t){let s,i;this.carrierlevelStopLogsSub&&this.carrierlevelStopLogsSub.off(),this.carrierlevelStopLogsSub.on("value",o=>{const a=o.val(),{stopUploadLogsUntil:d=0,timeStamp:m=0}=a||{},v=this.utilService.isDurationCompleted(m,d);a?v?(this.carrierlevelStopLogsSub&&this.carrierlevelStopLogsSub.off(),this.listenToDriverLevelStoplogs(t)):(i=this.utilService.getCompletionTime(m,d),this.carrierlevelStopLogsSub&&this.carrierlevelStopLogsSub.off(),s=`Logs have stopped uploading at the carrier level until ${i}. Would you like to force upload the log?`,this.openDialog(s,t)):(this.carrierlevelStopLogsSub&&this.carrierlevelStopLogsSub.off(),this.listenToDriverLevelStoplogs(t))})}listenToDriverLevelStoplogs(t){let s,i;this.driverlevelStopLogsSub&&this.driverlevelStopLogsSub.off(),this.driverlevelStopLogsSub.on("value",o=>{const a=o.val(),{status:d=0,stopUploadLogsUntil:m=0,timeStamp:v=0}=a||{},Z=this.utilService.isDurationCompleted(v,m);a?(this.driverlevelStopLogsSub&&this.driverlevelStopLogsSub.off(),4!==d&&5!==d||!Z?4!==d&&5!==d||Z?(this.driverlevelStopLogsSub&&this.driverlevelStopLogsSub.off(),this.triggerLogs(t)):(i=this.utilService.getCompletionTime(v,m),this.driverlevelStopLogsSub.on&&this.driverlevelStopLogsSub.off(),s=`Logs have stopped uploading for ${t.HOSUserName} until ${i}. Would you like to force upload the log?`,this.openDialog(s,t)):(this.driverlevelStopLogsSub.on&&this.driverlevelStopLogsSub.off(),this.triggerLogs(t))):(this.driverlevelStopLogsSub&&this.driverlevelStopLogsSub.off(),this.triggerLogs(t))})}triggerLogs(t,s){let i,o,a;s?(o=6,i="FORCE_UPLOAD",a="Force logs upload has been initiated."):(o=1,i="INITIATED",a="Logs upload has been initiated."),this.db.list("LOGS").update(`${t.HOSDriverId}`,{source:1,status:o,message:i,fileName:"",fileSize:0,ack:!1,driverName:t.HOSUserName,clientName:this.carrier.CarrierName,[mt.xF]:mt.fc,timeStamp:(new Date).getTime()}),this.toast.info(a)}openDialog(t,s){this.closeForceUploadLogsDialog=!1;const i=this.modalService.open(an,{size:"lg",scrollable:!0});i.componentInstance.message=t,i.componentInstance.closeForceUploadLogsDialog=this.closeForceUploadLogsDialog,i.componentInstance.onProceed.subscribe(o=>{const{proceed:a=!1}=o||{};a&&(this.closeForceUploadLogsDialog=!0,i.componentInstance.closeForceUploadLogsDialog=this.closeForceUploadLogsDialog,this.triggerLogs(s,!0))})}getLogsHistory(t){const s=this.modalService.open(nn.m,{windowClass:"modal-size-log",scrollable:!0});s.componentInstance.driver=t,s.componentInstance.locales={...this.locales}}stopLogs(t){let s=this.db.list("LOGS");this.closeTimeSelectionModal=!1;const i=this.modalService.open(At,{size:"md",scrollable:!0});i.componentInstance.driver=t,i.componentInstance.locales={...this.locales},i.componentInstance.closeTimeSelectionModal=this.closeTimeSelectionModal,i.componentInstance.submit.subscribe(o=>{const{duration:a}=o||{};o&&(this.closeTimeSelectionModal=!0,i.componentInstance.closeTimeSelectionModal=this.closeTimeSelectionModal,this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),s.update(`${t.HOSDriverId}`,{source:1,status:4,message:"STOP_UPLOAD",fileName:"",fileSize:0,[mt.xF]:null,stopUploadLogsUntil:a,ack:!1,driverName:"",clientName:"",timeStamp:(new Date).getTime()}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.info(0!=a?"The upload of audit logs has stopped.":"The upload of audit logs has restarted."))})}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.FF),e.Y36(Dt),e.Y36(n.Yd),e.Y36(y.T),e.Y36(p.e),e.Y36(N.jE),e.Y36(we.s),e.Y36(Le.F),e.Y36(b.f),e.Y36(dt.KQ))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-driver-list"]],viewQuery:function(s,i){if
1(1&s&&e.Gf(Se.e,5),2&s){let o;e.iGM(o=e.CRH())&&(i.dataGrid=o.first)}},inputs:{drivers:"drivers",locales:"locales",carrier:"carrier",role:"role"},outputs:{onActivate:"onActivate",onSendNotification:"onSendNotification",onDeleteDriver:"onDeleteDriver",onSendDriver:"onSendDriver",onDriverAdd:"onDriverAdd",onUnLockDriver:"onUnLockDriver",refreshDriverData:"refreshDriverData"},features:[e.TTD],decls:34,vars:52,consts:[[1,"container","table-size"],[1,"card","card-default"],[1,"card-header"],[1,"card-title"],[1,"card-tools"],["class","btn-group","style","margin-right: 15px;",4,"ngIf"],["type","button","class","btn btn-outline-primary",3,"click",4,"ngIf"],[1,"card-body"],["id","gridContainer","keyExpr","HOSDriverId",3,"dataSource","allowColumnResizing","columnAutoWidth","showBorders"],[3,"visible","placeholder"],[3,"pageSize"],[3,"enabled"],["location","before","locateInMenu","auto"],["displayExpr","Name","valueExpr","HOSHomeBaseId",3,"dataSource","searchMode","searchExpr","searchTimeout","minSearchLength","searchEnabled","showDataBeforeSearch","ngModel","ngModelOptions","width","noDataText","placeholder","onValueChanged","ngModelChange"],["displayExpr","label","valueExpr","code",3,"dataSource","ngModel","ngModelOptions","width","noDataText","onValueChanged","ngModelChange"],["location","after","widget","dxButton",3,"options"],["name","searchPanel"],["dataField","HOSDriverId","caption","ID","dataType","string",4,"ngIf"],["cellTemplate","nameTemplate","dataField","LastName",3,"caption"],["dataField","Name",3,"visible","caption"],["dataField","HOSUserName",3,"caption"],["dataField","HOSHomeBaseId","cellTemplate","homeBaseTemplate","dataType","string",3,"caption"],["dataField","LicenseNumber",3,"width","caption"],["dataField","HOSClientId","dataType","string","cellTemplate","carrierTemplate",3,"caption",4,"ngIf"],["dataField","IsActive","dataType","string","cellTemplate","activeTemplate",3,"width","caption"],["cellTemplate","actionsTemplate","dataType","boolean",3,"width","caption"],[4,"dxTemplate","dxTemplateOf"],["style","text-align: center;",4,"dxTemplate","dxTemplateOf"],[1,"btn-group",2,"margin-right","15px"],["type","button","data-toggle","dropdown",1,"btn","btn-outline-primary","dropdown-toggle"],[1,"fa","fa-download"],[1,"dropdown-menu"],["href","javascript:void(0)",1,"dropdown-item",3,"click"],[1,"far","fa-file-pdf"],[1,"far","fa-file-excel"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],["dataField","HOSDriverId","caption","ID","dataType","string"],["dataField","HOSClientId","dataType","string","cellTemplate","carrierTemplate",3,"caption"],[2,"text-align","center"],[3,"value","disabled","visible","onValueChanged"],["type","button",1,"btn","btn-link",3,"title","click"],[1,"fas","fa-edit"],["type","button","class","btn btn-link",3,"title","click",4,"ngIf"],["type","button","class","btn btn-link","title","Upload logs",3,"click",4,"ngIf"],["type","button","class","btn btn-link","title","Stop upload of Audit logs",3,"click",4,"ngIf"],[1,"fas","fa-unlock-alt"],[1,"far","fa-comment-dots"],[1,"fa","fa-archive"],[1,"fa","fa-cogs"],["type","button","title","Upload logs",1,"btn","btn-link",3,"click"],[1,"fa","fa-upload"],["type","button","title","Stop upload of Audit logs",1,"btn","btn-link",3,"click"],[1,"far","fa-stop-circle"],[1,"fa","fa-history"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA(),e.TgZ(5,"div",4),e.YNc(6,ln,11,1,"div",5),e.YNc(7,cn,3,1,"button",6),e.qZA()(),e.TgZ(8,"div",7)(9,"dx-data-grid",8),e._UZ(10,"dxo-search-panel",9)(11,"dxo-paging",10)(12,"dxo-load-panel",11),e.TgZ(13,"dxo-toolbar")(14,"dxi-item",12)(15,"dx-select-box",13),e.NdJ("onValueChanged",function(a){return i.homeBaseChange(a)})("ngModelChange",function(a){return i.selectedHomeBase=a}),e.qZA()(),e.TgZ(16,"dxi-item",12)(17,"dx-select-box",14),e.NdJ("onValueChanged",function(a){return i.driversFilterChange(a)})("ngModelChange",function(a){return i.selectedDriver=a}),e.qZA()(),e._UZ(18,"dxi-item",15)(19,"dxi-item",16),e.qZA(),e.YNc(20,dn,1,0,"dxi-column",17),e._UZ(21,"dxi-column",18)(22,"dxi-column",19)(23,"dxi-column",20)(24,"dxi-column",21)(25,"dxi-column",22),e.YNc(26,mn,1,1,"dxi-column",23),e._UZ(27,"dxi-column",24)(28,"dxi-column",25),e.YNc(29,un,4,3,"div",26),e.YNc(30,hn,3,1,"div",26),e.YNc(31,pn,2,2,"div",27),e.YNc(32,Tn,10,8,"div",27),e.YNc(33,yn,3,1,"div",26),e.qZA()()()()),2&s&&(e.xp6(4),e.Oqu(i.locales.drivers),e.xp6(2),e.Q6J("ngIf",(null==i.drivers?null:i.drivers.length)>0),e.xp6(1),e.Q6J("ngIf",5===i.driverPermission&&i.loginUser&&5===i.partnerId||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)&&((null==i.moaForUser?null:i.moaForUser.length)>0||5===(null==i.carrier?null:i.carrier.HOSPartnerId))||!i.loginUser&&5===i.partnerId),e.xp6(2),e.Q6J("dataSource",i.drivers)("allowColumnResizing",!0)("columnAutoWidth",!0)("showBorders",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize",15),e.xp6(1),e.Q6J("enabled",i.loading),e.xp6(3),e.s9C("noDataText",i.locales.noDataText),e.s9C("placeholder",i.locales.filterHomeBase),e.Q6J("dataSource",i.homeBases)("searchMode","contains")("searchExpr","Name")("searchTimeout",200)("minSearchLength",0)("searchEnabled",!0)("showDataBeforeSearch",!1)("ngModel",i.selectedHomeBase)("ngModelOptions",e.DdM(47,Lt))("width",225),e.xp6(2),e.s9C("noDataText",i.locales.noDataText),e.Q6J("dataSource",i.driversFilter)("ngModel",i.selectedDriver)("ngModelOptions",e.DdM(48,Lt))("width",150),e.xp6(1),e.Q6J("options",e.WLB(49,An,i.refreshData,i.locales.refresh)),e.xp6(2),e.Q6J("ngIf",3===i.roleHOS),e.xp6(1),e.s9C("caption",i.locales.name),e.xp6(1),e.s9C("caption",i.locales.name),e.Q6J("visible",!1),e.xp6(1),e.s9C("caption",i.locales.username),e.xp6(1),e.s9C("caption",i.locales.home_base),e.xp6(1),e.s9C("caption",i.locales.license_number),e.Q6J("width",150),e.xp6(1),e.Q6J("ngIf",i.moaForUser&&i.moaForUser.length>0),e.xp6(1),e.s9C("caption",i.locales.active),e.Q6J("width",70),e.xp6(1),e.s9C("caption",i.locales.actions),e.Q6J("width",350),e.xp6(1),e.Q6J("dxTemplateOf","nameTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","carrierTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","activeTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","actionsTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","homeBaseTemplate"))}
1,dependencies:[Q.O5,c.JJ,c.On,Se.e,ee.qvW,ee.ZT3,ee.mKI,ee.sXh,ee.XXE,ee.y1f,pe.p6,Me.v,Ee._,qt],styles:[".dx-datagrid-content .dx-datagrid-table .dx-row>td, .dx-datagrid-content[_ngcontent-%COMP%] .dx-datagrid-table[_ngcontent-%COMP%] .dx-row[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{vertical-align:inherit!important} .dx-datagrid-headers .dx-datagrid-table .dx-row.dx-header-row td{background-color:#e9ecef!important;color:#000!important;font-weight:600!important}"]})}return r})();function In(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",17),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.addCarrier())}),e._UZ(1,"i",18),e._uU(2),e.qZA()}if(2&r){const t=e.oxw();e.xp6(2),e.hij(" ",t.locales.newItem," ")}}function xn(r,l){if(1&r&&(e.TgZ(0,"div"),e._UZ(1,"div",19),e.qZA()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.Q6J("innerHTML",s.getCarrierCountry(t.data.CarrierCountry),e.oJD)}}function On(r,l){if(1&r&&(e.TgZ(0,"div"),e._uU(1),e.qZA()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.hij(" ",s.getTimeZone(t.data.TimeZoneCode)," ")}}function Un(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"button",20),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.editCarrier(o.data))}),e._UZ(2,"i",21),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.locales.edit)}}let Bt=(()=>{class r{constructor(t){this.utilService=t,this.onEditCarrier=new e.vpe,this.onAddCarrier=new e.vpe,this.moaCarriers=[],this.countries=[{key:1,label:"USA",img:"../../../assets/img/flags/usa.png"},{key:2,label:"Canada",img:"../../../assets/img/flags/canada.png"},{key:3,label:"Mexico",img:"../../../assets/img/flags/mexico.png"}]}ngOnInit(){this.moaCarriers=this.carriers.filter(t=>-1!==t.HOSPartnerId)}ngOnChanges(t){this.moaCarriers=this.carriers.filter(s=>-1!==s.HOSPartnerId)}editCarrier(t){this.onEditCarrier.emit(t)}addCarrier(){this.onAddCarrier.emit({})}getCarrierCountry(t){const s=this.countries.find(i=>i.key===t);return`<span><img src="${s?.img}"> ${s?.label}</span>`}getTimeZone(t){return this.utilService.Timezones.find(s=>s.key===t)?.label}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(b.f))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["moa-carriers"]],inputs:{carriers:"carriers",locales:"locales",role:"role"},outputs:{onEditCarrier:"onEditCarrier",onAddCarrier:"onAddCarrier"},features:[e.TTD],decls:20,vars:23,consts:[[1,"container","table-size"],[1,"card","card-default"],[1,"card-header"],[1,"card-title"],[1,"card-tools"],["type","button","class","btn btn-outline-primary",3,"click",4,"ngIf"],[1,"card-body"],["id","gridContainer",3,"dataSource","allowColumnReordering","allowColumnResizing","columnAutoWidth","showBorders","columnHidingEnabled"],[3,"visible","placeholder"],[3,"enabled"],["dataField","Name",3,"caption"],["dataField","CarrierId",3,"caption"],["dataField","CarrierAddress",3,"caption","width"],["dataField","CarrierCountry","cellTemplate","countryTemplate","dataType","string",3,"caption"],["dataField","TimeZoneCode","cellTemplate","timeZoneTemplate","dataType","string",3,"caption"],["cellTemplate","actionsTemplate",3,"width","caption"],[4,"dxTemplate","dxTemplateOf"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],[3,"innerHTML"],["type","button",1,"btn","btn-link",3,"title","click"],[1,"fas","fa-edit"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA(),e.TgZ(5,"div",4),e.YNc(6,In,3,1,"button",5),e.qZA()(),e.TgZ(7,"div",6)(8,"dx-data-grid",7),e._UZ(9,"dxo-search-panel",8)(10,"dxo-load-panel",9)(11,"dxi-column",10)(12,"dxi-column",11)(13,"dxi-column",12)(14,"dxi-column",13)(15,"dxi-column",14)(16,"dxi-column",15),e.YNc(17,xn,2,1,"div",16),e.YNc(18,On,2,1,"div",16),e.YNc(19,Un,3,1,"div",16),e.qZA()()()()),2&s&&(e.xp6(4),e.Oqu(i.locales.carriers),e.xp6(2),e.Q6J("ngIf",2===i.role||3===i.role||4===i.role),e.xp6(2),e.Q6J("dataSource",i.moaCarriers)("allowColumnReordering",!0)("allowColumnResizing",!0)("columnAutoWidth",!0)("showBorders",!0)("columnHidingEnabled",!0)("columnAutoWidth",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.Q6J("enabled",!1),e.xp6(1),e.s9C("caption",i.locales.name),e.xp6(1),e.s9C("caption",i.locales.dotnscNumber),e.xp6(1),e.s9C("caption",i.locales.address),e.Q6J("width",500),e.xp6(1),e.s9C("caption",i.locales.country),e.xp6(1),e.s9C("caption",i.locales.timezone),e.xp6(1),e.s9C("caption",i.locales.actions),e.Q6J("width",80),e.xp6(1),e.Q6J("dxTemplateOf","countryTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","timeZoneTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","actionsTemplate"))},dependencies:[Q.O5,Se.e,ee.qvW,ee.mKI,ee.XXE,pe.p6],styles:[".dx-datagrid-content .dx-datagrid-table .dx-row>td, .dx-datagrid-content[_ngcontent-%COMP%] .dx-datagrid-table[_ngcontent-%COMP%] .dx-row[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{vertical-align:inherit!important} .dx-datagrid-headers .dx-datagrid-table .dx-row.dx-header-row td{background-color:#e9ecef!important;color:#000!important;font-weight:600!important}"]})}return r})();function Zn(r,l){if(1&r&&(e.TgZ(0,"span",22),e._uU(1),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Oqu(t.locales.mainoffice)}}function wn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"dx-check-box",20),e.NdJ("onValueChanged",function(i){const a=e.CHM(t).$implicit,d=e.oxw();return e.KtG(d.onSelected(i,a.data))}),e.qZA(),e.YNc(2,Zn,2,1,"span",21),e.qZA()}if(2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.Q6J("disabled",s.CheckMainOffice(t.data))("value",s.CheckMainOffice(t.data)),e.xp6(1),e.Q6J("ngIf",0===t.data.HOSHomeBaseId)}}function Nn(r,l){if(1&r&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.Oqu(t.data.LastName+", "+t.data.Name)}}function Hn(r,l){if(1&r&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.Oqu(t.data.Name)}}function Dn(r,l){if(1&r&&(e.TgZ(0,"div"),e.YNc(1,Nn,2,1,"span",23),e.YNc(2,Hn,2,1,"span",23),e.qZA()),2&r){const t=l.$implicit;e.xp6(1),e.Q6J("ngIf",""!==t.data.LastName),e.xp6(1),e.Q6J("ngIf",""===t.data.LastName)}}let Et=(()=>
1{class r{constructor(t,s){this.activeModal=t,this.hosService=s,this.drivers=[],this.driverList=[]}ngOnInit(){const t=this.hosService.hosDrivers.filter(s=>1===s.IsActive);this.drivers=JSON.parse(JSON.stringify(t)),this.driverList=JSON.parse(JSON.stringify(t))}onSend(){this.activeModal.close(this.driverList)}CheckMainOffice(t){return t.HOSHomeBaseId===this.homebase.HOSHomeBaseId}onSelected(t,s){this.driverList=this.driverList.map(i=>(i.HOSDriverId===s.HOSDriverId&&t.value&&(i.HOSHomeBaseId=this.homebase.HOSHomeBaseId),i))}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(y.T))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-drivers-assigned"]],inputs:{locales:"locales",homebase:"homebase"},decls:28,vars:15,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"modal-body"],["role","form"],["ngbAutofocus","",1,"card-body"],[1,"row"],[1,"col-12"],[1,"header"],[1,"lead"],["id","gridContainer",3,"dataSource","showBorders","columnHidingEnabled"],[3,"visible","placeholder"],["cellTemplate","nameTemplate","dataField","Name","dataField","LastName",3,"caption"],["dataField","HOSUserName",3,"caption"],["cellTemplate","assigmentTemplate",3,"caption"],[4,"dxTemplate","dxTemplateOf"],[1,"modal-footer"],["type","button",1,"btn","btn-primary",3,"click"],["type","button",1,"btn","btn-outline-dark",3,"click"],[3,"disabled","value","onValueChanged"],["style","margin-left: 30px;",4,"ngIf"],[2,"margin-left","30px"],[4,"ngIf"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h5",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"form",5)(8,"div",6)(9,"div",7)(10,"div",8)(11,"div",9),e._uU(12),e.TgZ(13,"span",10),e._uU(14),e.qZA()()()(),e.TgZ(15,"div",7)(16,"dx-data-grid",11),e._UZ(17,"dxo-search-panel",12)(18,"dxi-column",13)(19,"dxi-column",14)(20,"dxi-column",15),e.YNc(21,wn,3,3,"div",16),e.YNc(22,Dn,3,2,"div",16),e.qZA()()()()(),e.TgZ(23,"div",17)(24,"button",18),e.NdJ("click",function(){return i.onSend()}),e._uU(25),e.qZA(),e.TgZ(26,"button",19),e.NdJ("click",function(){return i.activeModal.dismiss("Click close btn")}),e._uU(27),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.driverassignment),e.xp6(10),e.hij("",i.locales.location_name,": "),e.xp6(2),e.Oqu(i.homebase.Name),e.xp6(2),e.Q6J("dataSource",i.drivers)("showBorders",!0)("columnHidingEnabled",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.s9C("caption",i.locales.name),e.xp6(1),e.s9C("caption",i.locales.username),e.xp6(1),e.s9C("caption",i.locales.assignment),e.xp6(1),e.Q6J("dxTemplateOf","assigmentTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","nameTemplate"),e.xp6(3),e.Oqu(i.locales.save),e.xp6(2),e.Oqu(i.locales.close))},dependencies:[Q.O5,c._Y,c.JL,c.F,Se.e,ee.qvW,ee.XXE,pe.p6,Me.v],styles:[".header[_ngcontent-%COMP%]{font-size:1.2rem;font-weight:700;margin-bottom:1rem}.header[_ngcontent-%COMP%] .lead[_ngcontent-%COMP%]{font-size:1.2rem;font-weight:lighter}"]})}return r})();function Fn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",20),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.onHomeBaseAdd.emit())}),e._UZ(1,"i",21),e._uU(2),e.qZA()}if(2&r){const t=e.oxw();e.xp6(2),e.hij(" ",t.locales.newItem," ")}}function Mn(r,l){if(1&r&&e._UZ(0,"dxi-column",22),2&r){const t=e.oxw();e.s9C("caption",t.locales.actions),e.Q6J("width",150)}}function kn(r,l){if(1&r&&(e.TgZ(0,"div",23),e._UZ(1,"dx-check-box",24),e.qZA()),2&r){const t=l.$implicit;e.xp6(1),e.Q6J("value",t.data.DefaultHome)("disabled",!0)}}function qn(r,l){if(1&r&&(e.TgZ(0,"div"),e._uU(1),e.qZA()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.hij(" ",s.getTimeZone(t.data.TimeZoneCode)," ")}}function Ln(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",25),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.driversAssignment(i.data))}),e._UZ(1,"i",28),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.driverassignment)}}function Jn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",25),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.deleteHomeBase(i.data))}),e._UZ(1,"i",29),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.delete)}}function Bn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"button",25),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.onHomeBaseUpdate.emit(o.data))}),e._UZ(2,"i",26),e.qZA(),e.YNc(3,Ln,2,1,"button",27),e.YNc(4,Jn,2,1,"button",27),e.qZA()}if(2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.s9C("title",s.locales.details),e.xp6(2),e.Q6J("ngIf",5===s.driverPermission&&s.loginUser||!s.loginUser||s.loginUser&&(6===s.loginUser.HOSUserTypeId||7===s.loginUser.HOSUserTypeId)),e.xp6(1),e.Q6J("ngIf",1!==t.data.DefaultHome&&(3===s.homeBasePermission&&s.loginUser&&10!==s.loginUser.HOSUserTypeId||!s.loginUser||s.loginUser&&(6===s.loginUser.HOSUserTypeId||7===s.loginUser.HOSUserTypeId)))}}let Pt=(()=>
1{class r{constructor(t,s,i,o,a){this.modalService=t,this.homebaseService=s,this.confirmationDialogService=i,this.hosService=o,this.utilService=a,this.onDelete=new e.vpe,this.onHomeBaseUpdate=new e.vpe,this.onHomeBaseAdd=new e.vpe,this.onAssignment=new e.vpe}ngOnChanges(t){t.formState?.currentValue&&console.log(t.formState.currentValue)}ngOnInit(){this.loginUser=this.hosService.loginUser,this.loginUser&&(this.getHomeBaseModelPermission(),this.getDriverModelPermission()),this.pristineHomebase=this.homebaseService.getPristineHomeBase()}getHOSDrivers(){}getHomeBaseModelPermission(){this.homeBasePermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>3===s)?3:4}getDriverModelPermission(){this.driverPermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>5===s)?5:6}driversAssignment(t){const s=this.modalService.open(Et,{size:"xl",scrollable:!0});s.componentInstance.homebase={...t},s.componentInstance.locales={...this.locales},s.result.then(i=>{this.onAssignment.emit({drivers:i,homebase:t})},i=>{console.log("--reason--"),console.log(`Dismissed ${this.getDismissReason(i)}`)})}getDismissReason(t){return t===P.If.ESC?"by pressing ESC":t===P.If.BACKDROP_CLICK?"By clicking on a backdrop":`with ${t}`}deleteHomeBase(t){this.confirmationDialogService.confirm(this.locales.deleteHomeBase,this.locales.askDeleteHomeBase+" "+t.Name+"?").then(s=>{s&&this.onDelete.emit(t)}).catch(()=>console.log())}getTimeZone(t){const s=this.utilService.Timezones.find(i=>i.key===t);return s?s.label:""}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.FF),e.Y36(we.s),e.Y36(S.O),e.Y36(y.T),e.Y36(b.f))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-homebase-list"]],inputs:{homebases:"homebases",drivers:"drivers",locales:"locales",carrier:"carrier",formState:"formState"},outputs:{onDelete:"onDelete",onHomeBaseUpdate:"onHomeBaseUpdate",onHomeBaseAdd:"onHomeBaseAdd",onAssignment:"onAssignment"},features:[e.TTD],decls:22,vars:23,consts:[[1,"container","table-size"],[1,"card","card-default"],[1,"card-header"],[1,"card-title"],[1,"card-tools"],["type","button","class","btn btn-outline-primary",3,"click",4,"ngIf"],[1,"card-body"],["id","gridContainer","keyExpr","HOSHomeBaseId",3,"dataSource","allowColumnReordering","allowColumnResizing","columnAutoWidth","showBorders","columnHidingEnabled"],[3,"visible","placeholder"],[3,"pageSize"],[3,"enabled"],["dataField","Name",3,"caption"],["dataField","Address","dataType","string",3,"caption"],["dataField","Latitude","dataType","string",3,"caption"],["dataField","Longitude","dataType","string",3,"caption"],["dataField","TimeZoneCode","cellTemplate","timeZoneTemplate","dataType","string",3,"caption"],["cellTemplate","mainHomeBaseTemplate",3,"width","caption"],["cellTemplate","actionsTemplate",3,"width","caption",4,"ngIf"],["style","text-align: center;",4,"dxTemplate","dxTemplateOf"],[4,"dxTemplate","dxTemplateOf"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],["cellTemplate","actionsTemplate",3,"width","caption"],[2,"text-align","center"],[3,"value","disabled"],["type","button",1,"btn","btn-link",3,"title","click"],[1,"fas","fa-edit"],["type","button","class","btn btn-link",3,"title","click",4,"ngIf"],[1,"far","fa-address-book"],[1,"fas","fa-trash-alt"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA(),e.TgZ(5,"div",4),e.YNc(6,Fn,3,1,"button",5),e.qZA()(),e.TgZ(7,"div",6)(8,"dx-data-grid",7),e._UZ(9,"dxo-search-panel",8)(10,"dxo-paging",9)(11,"dxo-load-panel",10)(12,"dxi-column",11)(13,"dxi-column",12)(14,"dxi-column",13)(15,"dxi-column",14)(16,"dxi-column",15)(17,"dxi-column",16),e.YNc(18,Mn,1,2,"dxi-column",17),e.YNc(19,kn,2,2,"div",18),e.YNc(20,qn,2,1,"div",19),e.YNc(21,Bn,5,3,"div",19),e.qZA()()()()),2&s&&(e.xp6(4),e.Oqu(i.locales.home_bases),e.xp6(2),e.Q6J("ngIf",3===i.homeBasePermission&&i.loginUser&&10!==i.loginUser.HOSUserTypeId||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Q6J("dataSource",i.homebases)("allowColumnReordering",!0)("allowColumnResizing",!0)("columnAutoWidth",!0)("showBorders",!0)("columnHidingEnabled",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize",15),e.xp6(1),e.Q6J("enabled",!1),e.xp6(1),e.s9C("caption",i.locales.name),e.xp6(1),e.s9C("caption",i.locales.address),e.xp6(1),e.s9C("caption",i.locales.latitude),e.xp6(1),e.s9C("caption",i.locales.longitude),e.xp6(1),e.s9C("caption",i.locales.timezone),e.xp6(1),e.s9C("caption",i.locales.mainoffice),e.Q6J("width",130),e.xp6(1),e.Q6J("ngIf",(3===i.homeBasePermission||5===i.driverPermission)&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(1),e.Q6J("dxTemplateOf","mainHomeBaseTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","timeZoneTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","actionsTemplate"))},dependencies:[Q.O5,Se.e,ee.qvW,ee.mKI,ee.sXh,ee.XXE,pe.p6,Me.v],styles:[".dx-datagrid-content .dx-datagrid-table .dx-row>td, .dx-datagrid-content[_ngcontent-%COMP%] .dx-datagrid-table[_ngcontent-%COMP%] .dx-row[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{vertical-align:inherit!important} .dx-datagrid-headers .dx-datagrid-table .dx-row.dx-header-row td{background-color:#e9ecef!important;color:#000!important;font-weight:600!important}"],changeDetection:0})}return r})();var En=F(48569);let Pn=(()=>
1{class r{constructor(t,s){this.activeModal=t,this.fb=s,this.onSubmit=new e.vpe}ngOnInit(){}ngDoCheck(){this.formState&&this.formState.submited&&this.activeModal.close()}decline(){this.activeModal.dismiss()}proceed(){this.onSubmit.emit({disconnect:!0})}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(P.Kz),e.Y36(c.QS))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-confirm-ecm-disconnect-modal"]],inputs:{locales:"locales",formState:"formState",asset:"asset"},outputs:{onSubmit:"onSubmit"},decls:19,vars:5,consts:[[1,"modal-header"],[1,"modal-title"],["type","button","aria-label","Close","tabindex","-1",1,"close",3,"click"],["aria-hidden","true"],[1,"dialog-body"],[1,"card-body"],[1,"modal-footer"],[1,"bold"],["type","button",1,"btn","btn-primary",3,"click"],["type","button",1,"btn","btn-outline-dark",3,"click"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"h4",1),e._uU(2),e.qZA(),e.TgZ(3,"button",2),e.NdJ("click",function(){return i.activeModal.dismiss("Cross click")}),e.TgZ(4,"span",3),e._uU(5,"\xd7"),e.qZA()()(),e.TgZ(6,"div",4)(7,"div",5)(8,"div")(9,"p"),e._uU(10),e.qZA()()()(),e.TgZ(11,"div",6)(12,"div")(13,"p",7),e._uU(14),e.qZA()(),e.TgZ(15,"button",8),e.NdJ("click",function(){return i.proceed()}),e._uU(16),e.qZA(),e.TgZ(17,"button",9),e.NdJ("click",function(){return i.decline()}),e._uU(18),e.qZA()()),2&s&&(e.xp6(2),e.Oqu(i.locales.pleaseConfirm),e.xp6(8),e.Oqu(i.locales.dis_conn_ecm),e.xp6(4),e.Oqu(i.locales.versionCompatible),e.xp6(2),e.Oqu(i.locales.yes),e.xp6(2),e.Oqu(i.locales.no))},styles:[".bold[_ngcontent-%COMP%]{font-weight:700;color:red}"]})}return r})();function Rn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",30),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.openAssetForm())}),e._UZ(1,"i",31),e._uU(2),e.qZA()}if(2&r){const t=e.oxw();e.xp6(2),e.hij(" ",t.locales.newItem," ")}}function Yn(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(2),e.Oqu(0===t.data.Type?s.locales.tractor:s.locales.trailer)}}function $n(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(2),e.Oqu(s.getAssetSubtype(t.data.HOSAssetSubTypeId))}}function Qn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",32)(1,"dx-check-box",33),e.NdJ("onValueChanged",function(i){const a=e.CHM(t).$implicit,d=e.oxw();return e.KtG(d.activateAsset(i,a.data))}),e.qZA()()}if(2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.Q6J("value",t.data.Active)("disabled",!(s.loginUser&&7===s.assetPermission||6===(null==s.loginUser?null:s.loginUser.HOSUserTypeId)||!s.loginUser))}}function Vn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",37),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.getLogsHistory(i.data))}),e._UZ(1,"i",38),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.logsHistory)}}function Wn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",32)(1,"button",34),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.onAssetUpdate.emit(o.data))}),e._UZ(2,"i",35),e.qZA(),e.YNc(3,Vn,2,1,"button",36),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.locales.details),e.xp6(2),e.Q6J("ngIf",t.loginUser&&6===t.loginUser.HOSUserTypeId)}}function zn(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(2),e.Oqu(s.getHomeBaseName(t.data.HOSHomeBaseId))}}function jn(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(2),e.Oqu(s.getFuelType(t.data))}}function Gn(r,l){if(1&r&&(e.TgZ(0,"span",41),e._UZ(1,"i",42),e.qZA()),2&r){const t=e.oxw(2);e.s9C("title",t.locales.ecmDisconnected)}}function Kn(r,l){if(1&r&&(e.TgZ(0,"span",41),e._UZ(1,"i",43),e.qZA()),2&r){const t=e.oxw(2);e.s9C("title",t.locales.driverLoggedinEcmConnected)}}function Xn(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"span",44),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.disconnectFromEcm(i.data))}),e._UZ(1,"i",43),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.driverLoggedoutEcmConnecte)}}function ea(r,l){if(1&r&&(e.TgZ(0,"div",32),e.YNc(1,Gn,2,1,"span",39),e.YNc(2,Kn,2,1,"span",39),e.YNc(3,Xn,2,1,"span",40),e.qZA()),2&r){const t=l.$implicit;e.xp6(1),e.Q6J("ngIf",!t.data.ImeiCode&&t.data.AssetId>0&&0===t.data.Type),e.xp6(1),e.Q6J("ngIf",t.data.ImeiCode&&t.data.AssetId>0&&t.data.HOSDriverId>0&&0===t.data.Type),e.xp6(1),e.Q6J("ngIf",t.data.ImeiCode&&0===t.data.HOSDriverId&&0===t.data.Type)}}function ta(r,l){if(1&r&&(e.TgZ(0,"div",45)(1,"div")(2,"span",46),e._UZ(3,"i",43),e.qZA(),e.TgZ(4,"span"),e._uU(5),e.qZA(),e.TgZ(6,"span",46),e._UZ(7,"i",42),e.qZA(),e.TgZ(8,"span"),e._uU(9),e.qZA()()()),2&r){const t=e.oxw();e.xp6(5),e.Oqu(t.locales.ecmConnected),e.xp6(4),e.Oqu(t.locales.ecmDisconnected)}}const Rt=function(){return{standalone:!0}},ia=function(r){return{icon:"refresh",onClick:r}};var je=(()=>{return(r=je||(je={}))[r.CONNECTED=0]="CONNECTED",r[r.INITIATED=1]="INITIATED",r[r.DISCONNECTED=2]="DISCONNECTED",je;var r})();let sa=(()=>
1{class r{constructor(t,s,i,o,a,d,m,v,Z){this.hosService=t,this.eventBus=s,this.homeBaseService=i,this.utilService=o,this.modalService=a,this.assetService=d,this.toast=m,this.db=v,this.authService=Z,this.currentCarrier=null,this.onAssetAdd=new e.vpe,this.onAssetUpdate=new e.vpe,this.onActivateAsset=new e.vpe,this.refreshAssets=new e.vpe,this.assetsCopy=[],this.loading=!1,this.homeBases=[],this.assetType=[],this.refreshData=()=>{this.refreshAssets.emit({action:"assets",itemData:this.currentCarrier,moa:this.moaForUser,fetchLatest:!0})}}ngOnInit(){this.assetType=[{key:-1,label:this.locales.allAssetTypes},{key:0,label:this.locales.tractor},{key:1,label:this.locales.trailer}],this.loginUser=this.hosService.loginUser,this.loginUser&&this.getAssetModelPermission()}ngOnChanges(t){if(this.hosService.homeBasesAdmin&&(this.homeBases=[...this.hosService.homeBasesAdmin],void 0===this.homeBases.find(i=>-1===i.HOSHomeBaseId))){const i=this.homeBaseService.getPristineHomeBase();i.Name=this.locales.allHomeBases,this.homeBases=[i,...this.hosService.homeBasesAdmin]}this.assets&&(this.assetsCopy=[...this.assets],this.selectedHomeBase=null,this.selectedAssetType=null)}ngOnDestroy(){this.ecmConnectionSub&&this.ecmConnectionSub.off(),this.ecmDisconnectTimeout&&clearTimeout(this.ecmDisconnectTimeout),this.resetRTDBTimeout&&clearTimeout(this.resetRTDBTimeout)}getAssetModelPermission(){this.assetPermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>7===s)?7:8}getHomeBaseName(t){if(this.hosService.homeBasesAdmin&&this.hosService.homeBasesAdmin.length>0){let s=this.hosService.homeBasesAdmin.find(i=>i.HOSHomeBaseId===t);return s?s.Name:this.locales.noHomeBase}return this.locales.noHomeBase}openAssetForm(){this.onAssetAdd.emit()}homeBaseChange(t){switch(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.selectedHomeBase=t.value,this.assetsCopy?.length>0&&(this.assets=[...this.assetsCopy]),t.value){case void 0:case null:case 0:this.assets=[...this.assetsCopy];break;default:this.assets=this.assets.filter(s=>s.HOSHomeBaseId===t.value)}null!=this.selectedAssetType&&this.selectedAssetType>=0&&(this.assets=this.assets.filter(s=>s.Type===this.selectedAssetType)),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}assetTypeChange(t){switch(this.selectedAssetType=t.value,this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.assetsCopy?.length>0&&(this.assets=[...this.assetsCopy]),t.value){case void 0:case null:case-1:this.assets=[...this.assetsCopy];break;default:this.assets=this.assets.filter(s=>s.Type===t.value)}this.selectedHomeBase>0&&(this.assets=this.assets.filter(s=>s.HOSHomeBaseId===this.selectedHomeBase)),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}getAssetSubtype(t){const s=this.hosService.assetsSubtypes.find(i=>i.HOSAssetSubTypeId===t);return s?s.HOSAssetSubTypeName:""}getFuelType(t){const s=this.utilService.fuelTypeList.find(i=>i.code===t.FuelTypeId&&0===t.Type);return s?s.label:""}getLogsHistory(t){const s=this.modalService.open(En.l,{windowClass:"modal-size-log",scrollable:!1});s.componentInstance.asset=t,s.componentInstance.locales={...this.locales}}activateAsset(t,s){const i=s.Active,o=+t.value;let a={loading:!1,submited:!1,errors:!1,message:""};const{CountMode:d=0}=this.authService?.appReseller,m=localStorage.getItem("statusChangeConfirmed")||"no";if(1!==d&&2!==d||!m||"yes"===m)s.Active=o,this.onActivateAsset.emit(s);else{const v=this.modalService.open(kt,{scrollable:!0,size:"md"});v.componentInstance&&(v.componentInstance.formState=JSON.parse(JSON.stringify(a))),v.componentInstance.onStatusChange.subscribe(Z=>{Z&&(s.Active=o,this.onActivateAsset.emit(s)),a={loading:!1,submited:!0,errors:!1,message:""},v.componentInstance&&(v.componentInstance.formState=JSON.parse(JSON.stringify(a)))}),v.result.catch(()=>{s.Active=i,this.dataGrid.instance.refresh()})}}disconnectFromEcm(t){this.fileList=this.db.list(`${t.ImeiCode}`),this.openConfirmation(t)}openConfirmation(t){const{ImeiCode:s=null,HOSDriverId:i=null}=t||{};this.ecmConnectionSub&&this.ecmConnectionSub.off();let o={loading:!1,submited:!1,errors:!1,message:""};if(s&&!i){const a=this.modalService.open(Pn,{size:"lg",scrollable:!0});a.componentInstance.asset=t,a.componentInstance.locales={...this.locales},a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(o)));const d=a.componentInstance.onSubmit.subscribe(m=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),m&&(o={loading:!1,submited:!0,errors:!1,message:""},a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(o))),this.updateRTDBNode(t))});a.result.finally(()=>d.unsubscribe())}}updateRTDBNode(t){this.fileList.update("ECM_DISCONNNECT",{source:1,status:je.INITIATED,timeStamp:(new Date).getTime()}),this.ecmDisconnectTimeout&&clearTimeout(this.ecmDisconnectTimeout),this.ecmDisconnectTimeout=setTimeout(()=>{this.refreshData(),this.listenToRTDB(t)},5e3)}listenToRTDB(t){this.ecmConnectionSub=this.db.database.ref(`${t.ImeiCode}/ECM_DISCONNNECT/status`),this.ecmConnectionSub.on("value",s=>{2===s.val()&&this.toast.success(this.locales.ecmDisconnectedSuccessfully)})}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(y.T),e.Y36(n.Yd),e.Y36(we.s),e.Y36(b.f),e.Y36(P.FF),e.Y36(ct.d),e.Y36(N.jE),e.Y36(dt.KQ),e.Y36(p.e))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-asset-list"]],viewQuery:function(s,i){if
1(1&s&&e.Gf(Se.e,5),2&s){let o;e.iGM(o=e.CRH())&&(i.dataGrid=o.first)}},inputs:{assets:"assets",locales:"locales",currentCarrier:"currentCarrier",moaForUser:"moaForUser"},outputs:{onAssetAdd:"onAssetAdd",onAssetUpdate:"onAssetUpdate",onActivateAsset:"onActivateAsset",refreshAssets:"refreshAssets"},features:[e.TTD],decls:39,vars:65,consts:[[1,"container","table-size"],[1,"card","card-default"],[1,"card-header"],[1,"card-title"],[1,"card-tools"],["type","button","class","btn btn-outline-primary",3,"click",4,"ngIf"],[1,"card-body"],["id","gridContainer","keyExpr","AssetId",3,"dataSource","allowColumnResizing","columnAutoWidth","showBorders"],[3,"visible","placeholder"],[3,"pageSize"],[3,"enabled"],["location","before","locateInMenu","auto"],["displayExpr","Name","valueExpr","HOSHomeBaseId",3,"dataSource","searchMode","searchExpr","searchTimeout","minSearchLength","searchEnabled","showDataBeforeSearch","ngModel","ngModelOptions","width","noDataText","placeholder","onValueChanged","ngModelChange"],["displayExpr","label","valueExpr","key",3,"dataSource","searchMode","searchExpr","searchTimeout","minSearchLength","searchEnabled","showDataBeforeSearch","ngModel","ngModelOptions","width","noDataText","placeholder","onValueChanged","ngModelChange"],["name","searchPanel"],["location","after","widget","dxButton",3,"options"],["cellTemplate","TypeTemplate","dataField","Type","dataType","string",3,"width","caption"],["cellTemplate","SubtypeTemplate","dataField","HOSAssetSubTypeId","dataType","string",3,"caption"],["dataField","Number",3,"width","caption"],["dataField","VIN",3,"caption"],["dataField","FuelTypeId","cellTemplate","fuelTypeTemplate","dataType","string",3,"caption"],["dataField","Plate",3,"width","caption"],["dataField","RegistrationState",3,"caption"],["dataField","HOSHomeBaseId","cellTemplate","homeBaseTemplate","dataType","string",3,"caption"],["cellTemplate","ecmConnTypeTemplate","dataType","string",3,"visible","width","caption"],["dataField","Active","dataType","string","cellTemplate","activeAssetTemplate",3,"width","caption"],["cellTemplate","actionsTemplate",3,"width","caption"],[4,"dxTemplate","dxTemplateOf"],["style","text-align: center;",4,"dxTemplate","dxTemplateOf"],["style","text-align: right","class","mr-3",4,"ngIf"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],[2,"text-align","center"],[3,"value","disabled","visible","onValueChanged"],["type","button",1,"btn","btn-link",2,"color","#007bff",3,"title","click"],[1,"fas","fa-edit"],["type","button","class","btn btn-link",3,"title","click",4,"ngIf"],["type","button",1,"btn","btn-link",3,"title","click"],[1,"fa","fa-history"],["class","fa-stack",3,"title",4,"ngIf"],["class","fa-stack cursor",3,"title","click",4,"ngIf"],[1,"fa-stack",3,"title"],[1,"fas","fa-link","fa-stack-1x",2,"color","#e74c3c"],[1,"fas","fa-link","fa-stack-1x",2,"color","#27ae60"],[1,"fa-stack","cursor",3,"title","click"],[1,"mr-3",2,"text-align","right"],[1,"fa-stack"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA(),e.TgZ(5,"div",4),e.YNc(6,Rn,3,1,"button",5),e.qZA()(),e.TgZ(7,"div",6)(8,"dx-data-grid",7),e._UZ(9,"dxo-search-panel",8)(10,"dxo-paging",9)(11,"dxo-load-panel",10),e.TgZ(12,"dxo-toolbar")(13,"dxi-item",11)(14,"dx-select-box",12),e.NdJ("onValueChanged",function(a){return i.homeBaseChange(a)})("ngModelChange",function(a){return i.selectedHomeBase=a}),e.qZA()(),e.TgZ(15,"dxi-item",11)(16,"dx-select-box",13),e.NdJ("onValueChanged",function(a){return i.assetTypeChange(a)})("ngModelChange",function(a){return i.selectedAssetType=a}),e.qZA()(),e._UZ(17,"dxi-item",14)(18,"dxi-item",15),e.qZA(),e._UZ(19,"dxi-column",16)(20,"dxi-column",17)(21,"dxi-column",18)(22,"dxi-column",19)(23,"dxi-column",20)(24,"dxi-column",21)(25,"dxi-column",22)(26,"dxi-column",23)(27,"dxi-column",24)(28,"dxi-column",25)(29,"dxi-column",26),e.YNc(30,Yn,3,1,"div",27),e.YNc(31,$n,3,1,"div",27),e.YNc(32,Qn,2,2,"div",28),e.YNc(33,Wn,4,2,"div",28),e.YNc(34,zn,3,1,"div",27),e.YNc(35,jn,3,1,"div",27),e.YNc(36,ea,4,3,"div",28),e.qZA()(),e.TgZ(37,"div"),e.YNc(38,ta,10,2,"div",29),e.qZA()()()),2&s&&(e.xp6(4),e.Oqu(i.locales.assets),e.xp6(2),e.Q6J("ngIf",7===i.assetPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Q6J("dataSource",i.assets)("allowColumnResizing",!0)("columnAutoWidth",!0)("showBorders",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize",15),e.xp6(1),e.Q6J("enabled",i.loading),e.xp6(3),e.s9C("noDataText",i.locales.noDataText),e.s9C("placeholder",i.locales.filterHomeBase),e.Q6J("dataSource",i.homeBases)("searchMode","contains")("searchExpr","Name")("searchTimeout",200)("minSearchLength",0)("searchEnabled",!0)("showDataBeforeSearch",!1)("ngModel",i.selectedHomeBase)("ngModelOptions",e.DdM(61,Rt))("width",225),e.xp6(2),e.s9C("noDataText",i.locales.noDataText),e.s9C("placeholder",i.locales.filterAssetType),e.Q6J("dataSource",i.assetType)("searchMode","contains")("searchExpr","label")("searchTimeout",200)("minSearchLength",0)("searchEnabled",!0)("showDataBeforeSearch",!1)("ngModel",i.selectedAssetType)("ngModelOptions",e.DdM(62,Rt))("width",225),e.xp6(2),e.Q6J("options",e.VKq(63,ia,i.refreshData)),e.xp6(1),e.s9C("caption",i.locales.type),e.Q6J("width",115),e.xp6(1),e.s9C("caption",i.locales.assetSubtype),e.xp6(1),e.s9C("caption",i.locales.number),e.Q6J("width",150),e.xp6(1),e.s9C("caption",i.locales.vin),e.xp6(1),e.s9C("caption",i.locales.fuelType),e.xp6(1),e.s9C("caption",i.locales.plate),e.Q6J("width",150),e.xp6(1),e.s9C("caption",i.locales.registration_state),e.xp6(1),e.s9C("caption",i.locales.home_base),e.xp6(1),e.s9C("caption",i.locales.ecm_connection),e.Q6J("visible",i.loginUser&&6===i.loginUser.HOSUserTypeId)("width",140),e.xp6(1),e.s9C("caption",i.locales.active),e.Q6J("width",85),e.xp6(1),e.s9C("caption",i.locales.actions),e.Q6J("width",150),e.xp6(1),e.Q6J("dxTemplateOf","TypeTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","SubtypeTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","activeAssetTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","actionsTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","homeBaseTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","fuelTypeTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","ecmConnTypeTemplate"),e.xp6(2),e.Q6J("ngIf",i.loginUser&&6===i.loginUser.HOSUserTypeId))}
1,dependencies:[Q.O5,c.JJ,c.On,Se.e,ee.qvW,ee.ZT3,ee.mKI,ee.sXh,ee.XXE,ee.y1f,pe.p6,Me.v,Ee._],styles:[".cursor[_ngcontent-%COMP%]{cursor:pointer} .dx-datagrid-content .dx-datagrid-table .dx-row>td, .dx-datagrid-content[_ngcontent-%COMP%] .dx-datagrid-table[_ngcontent-%COMP%] .dx-row[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{vertical-align:inherit!important} .dx-datagrid-headers .dx-datagrid-table .dx-row.dx-header-row td{background-color:#e9ecef!important;color:#000!important;font-weight:600!important}"]})}return r})();var ra=F(42378),Yt=F(29878),oa=F(97379);function na(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"button",17),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.editSupport(o.data))}),e._UZ(2,"i",18),e.qZA(),e.TgZ(3,"button",17),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.deleteSupport(o.data))}),e._UZ(4,"i",19),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.locales.editUser),e.xp6(2),e.s9C("title",t.locales.deleteUser)}}function aa(r,l){if(1&r&&(e.TgZ(0,"div"),e._uU(1),e.qZA()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(1),e.hij(" ",s.getUserTypeName(t.data.HOSUserTypeId)," ")}}let la=(()=>{class r{constructor(t,s,i,o,a,d,m,v){this.roleService=t,this.modalService=s,this.eventBus=i,this.userService=o,this.toast=a,this.hosService=d,this.confirmDialogService=m,this.utilService=v}ngOnInit(){}addSupport(){let t={loading:!1,submited:!1,errors:!1,message:""};const s=this.modalService.open(Yt.m,{size:"lg",scrollable:!0});s.componentInstance.locales={...this.locales},s.componentInstance&&(s.componentInstance.formState=JSON.parse(JSON.stringify(t))),s.componentInstance.user=new ra.X,s.componentInstance.formType=1,s.componentInstance.noMasterReseller=!0,s.componentInstance.userType=this.roleService.userType,s.componentInstance.isReseller=!1,s.componentInstance.carriers=[this.currentCarrier],s.componentInstance.roleHOS=this.role,s.componentInstance.HOSBillingId=this.currentCarrier.HOSBillingId,s.componentInstance.HOSPartnerId=this.currentCarrier.HOSPartnerId,s.componentInstance.supportForm=!0;const i=s.componentInstance.onSubmit.subscribe(o=>{t={loading:!0,submited:!1,errors:!1,message:""},s.componentInstance&&(s.componentInstance.formState=JSON.parse(JSON.stringify(t))),this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.userService.insertUser(o,1!==this.role).subscribe(a=>{const{code:d,data:m}=a.d;switch(d){case 1:this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),t={loading:!1,submited:!0,errors:!1,message:""},s.componentInstance&&(s.componentInstance.formState=JSON.parse(JSON.stringify(t))),this.hosService.appSupportUsersList&&this.appSupportUsersList.push(m);break;case 211:this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),t={loading:!1,submited:!0,errors:!0,message:this.locales.usernameExist},s.componentInstance&&(s.componentInstance.formState=JSON.parse(JSON.stringify(t)));break;case 225:this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),t={loading:!1,submited:!0,errors:!0,message:this.locales.externalUsernameDuplicated},s.componentInstance&&(s.componentInstance.formState=JSON.parse(JSON.stringify(t)));break;default:this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),t={loading:!1,submited:!0,errors:!0,message:this.locales.error_trying_save},s.componentInstance&&(s.componentInstance.formState=JSON.parse(JSON.stringify(t)))}},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),t={loading:!1,submited:!0,errors:!0,message:this.locales.error500},s.componentInstance&&(s.componentInstance.formState=JSON.parse(JSON.stringify(t)))})});s.result.finally(()=>i.unsubscribe())}editSupport(t){const i=this.modalService.open(Yt.m,{size:"lg",scrollable:!0});i.componentInstance.locales={...this.locales},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!1,errors:!1,message:""}))),i.componentInstance.user=t,i.componentInstance.formType=2,i.componentInstance.carriers=[this.currentCarrier],i.componentInstance.roleHOS=this.role,i.componentInstance.userType=this.roleService.userType,i.componentInstance.isReseller=!1,i.componentInstance.HOSBillingId=this.currentCarrier.HOSBillingId,i.componentInstance.HOSPartnerId=this.currentCarrier.HOSPartnerId,i.componentInstance.supportForm=!0;const o=i.componentInstance.onSubmit.subscribe(a=>{let d={loading:!0,submited:!1,errors:!1,message:""};i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(d))),this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.userService.updateUser(a,2===this.role||3===this.role).subscribe(m=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:v}=m.d;switch(v){case 1:{d={loading:!1,submited:!0,errors:!1,message:""},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(d))),this.toast.success(this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0});const H=this.appSupportUsersList.findIndex(w=>w.HOSUserId===t.HOSUserId);-1!==H&&(this.appSupportUsersList[H]=a);break}case 211:d={loading:!1,submited:!0,errors:!0,message:this.locales.usernameExist},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(d)));break;case 225:d={loading:!1,submited:!0,errors:!0,message:this.locales.externalUsernameDuplicated},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(d)));break;case 230:d={loading:!1,submited:!0,errors:!0,message:this.locales.cannotEditFullAccessUser},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(d)));break;default:d={loading:!1,submited:!0,errors:!0,message:this.locales.error_trying_update},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(d)))}},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),d={loading:!1,submited:!0,errors:!0,message:this.locales.error500},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(d)))})});i.result.finally(()=>o.unsubscribe())}deleteSupport(t){this.confirmDialogService.confirm(this.locales.pleaseConfirm,this.locales.askDeleteUser+t.UserName+"?").then(s=>{s&&(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.userService.deleteUser(t.HOSUserId,t.HOSBillingId,t.HOSClients[0].HOSClientId,t.HOSAccountId).subscribe(i=>{const{code:o}=i.d;switch(o){case 1:{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.success(this.locales.deleted_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0});const d=this.appSupportUsersList.findIndex(m=>m.HOSUserId===t.HOSUserId);-1!==d&&this.appSupportUsersList.splice(d,1);break}case 228:this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.userNotDeletedUser,{style:this.utilService.errorStyleMsg,duration:4e3,dismissible:!0});break;default:this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error_trying_delete,{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0})}},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0})}
1))}).catch(()=>console.log())}getUserTypeName(t){return[...this.roleService.userType].find(o=>o.HOSUserTypeId===t).label}test(){console.log(this.appSupportUsersList)}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(oa.N),e.Y36(P.FF),e.Y36(n.Yd),e.Y36(Nt.K),e.Y36(N.jE),e.Y36(y.T),e.Y36(S.O),e.Y36(b.f))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["support-users"]],inputs:{locales:"locales",appSupportUsersList:"appSupportUsersList",role:"role",currentCarrier:"currentCarrier"},decls:20,vars:18,consts:[[1,"container","table-size"],[1,"card","card-default"],[1,"card-header"],[1,"card-title"],[1,"card-tools"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],[1,"card-body"],["id","gridContainer",3,"columnAutoWidth","dataSource","showBorders","columnHidingEnabled"],[3,"visible","placeholder"],[3,"pageSize"],[3,"enabled"],["dataField","UserName",3,"caption"],["dataField","Email",3,"caption"],["dataField","HOSUserTypeId","dataType","string","cellTemplate","userTypeTemplate",3,"caption"],["cellTemplate","actionsTemplate",3,"width","caption"],[4,"dxTemplate","dxTemplateOf"],["type","button",1,"btn","btn-link",3,"title","click"],[1,"fas","fa-edit"],[1,"fas","fa-trash-alt"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA(),e.TgZ(5,"div",4)(6,"button",5),e.NdJ("click",function(){return i.addSupport()}),e._UZ(7,"i",6),e._uU(8),e.qZA()()(),e.TgZ(9,"div",7)(10,"dx-data-grid",8),e._UZ(11,"dxo-search-panel",9)(12,"dxo-paging",10)(13,"dxo-load-panel",11)(14,"dxi-column",12)(15,"dxi-column",13)(16,"dxi-column",14)(17,"dxi-column",15),e.YNc(18,na,5,2,"div",16),e.YNc(19,aa,2,1,"div",16),e.qZA()()()()),2&s&&(e.xp6(4),e.Oqu(i.locales.appSupportUsers),e.xp6(4),e.hij(" ",i.locales.newItem," "),e.xp6(2),e.Q6J("columnAutoWidth",!0)("dataSource",i.appSupportUsersList)("showBorders",!0)("columnHidingEnabled",!0)("columnAutoWidth",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize",15),e.xp6(1),e.Q6J("enabled",!1),e.xp6(1),e.s9C("caption",i.locales.username),e.xp6(1),e.s9C("caption",i.locales.email),e.xp6(1),e.s9C("caption",i.locales.userType),e.xp6(1),e.s9C("caption",i.locales.actions),e.Q6J("width",150),e.xp6(1),e.Q6J("dxTemplateOf","actionsTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","userTypeTemplate"))},dependencies:[Se.e,ee.qvW,ee.mKI,ee.sXh,ee.XXE,pe.p6],styles:[".dx-datagrid-content .dx-datagrid-table .dx-row>td, .dx-datagrid-content[_ngcontent-%COMP%] .dx-datagrid-table[_ngcontent-%COMP%] .dx-row[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{vertical-align:inherit!important} .dx-datagrid-headers .dx-datagrid-table .dx-row.dx-header-row td{background-color:#e9ecef!important;color:#000!important;font-weight:600!important}"]})}return r})(),$t=(()=>{class r{constructor(t,s){this.utilService=t,this.localesService=s,this.notificationTypes=this.utilService.getHosNotificationTypes(),this.localesService.getCurrentLocales().subscribe(i=>{const{locales:o}=i;this.locales={...o},this.notificationTypes=this.notificationTypes.map(a=>(-1===a.key&&(a.label=this.locales.noti_type),1===a.key&&(a.label=this.locales.unidentified_driving),2===a.key&&(a.label=this.locales.hos_violation),3===a.key&&(a.label=this.locales.eld_malfunction),4===a.key&&(a.label=this.locales.driving_no_ecm),a))})}transform(t){return this.notificationTypes.find(s=>s.key===t).label}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(b.f,16),e.Y36(Ut.n,16))};static#t=this.\u0275pipe=e.Yjl({name:"notiType",type:r,pure:!0})}return r})();function ca(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){e.CHM(t);const i=e.oxw();return e.KtG(i.onAdd.emit())}),e._UZ(1,"i",20),e._uU(2),e.qZA()}if(2&r){const t=e.oxw();e.xp6(2),e.hij(" ",t.locales.newItem," ")}}const da=function(){return{standalone:!0}};function ma(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"dxi-item",21)(1,"dx-select-box",22),e.NdJ("onValueChanged",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.homeBaseChange(i))})("ngModelChange",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.selectedHomeBase=i)}),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("noDataText",t.locales.noDataText),e.s9C("placeholder",t.locales.filterHomeBase),e.Q6J("dataSource",t.homeBases)("searchMode","contains")("searchExpr","Name")("searchTimeout",200)("minSearchLength",0)("searchEnabled",!0)("showDataBeforeSearch",!1)("ngModel",t.selectedHomeBase)("ngModelOptions",e.DdM(12,da))("width",225)}}function ua(r,l){if(1&r&&e._UZ(0,"dxi-column",23),2&r){const t=e.oxw();e.s9C("caption",t.locales.home_base)}}function ha(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.ALo(3,"notiType"),e.qZA()()),2&r){const t=l.$implicit;
1e.xp6(2),e.Oqu(e.lcZ(3,1,t.data.Type))}}function pa(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit,o=e.oxw();return e.KtG(o.onDelete.emit(i.data))}),e._UZ(1,"i",27),e.qZA()}if(2&r){const t=e.oxw(2);e.s9C("title",t.locales.delete_notification)}}function fa(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"button",24),e.NdJ("click",function(){const o=e.CHM(t).$implicit,a=e.oxw();return e.KtG(a.onUpdate.emit(o.data))}),e._UZ(2,"i",25),e.qZA(),e.YNc(3,pa,2,1,"button",26),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.s9C("title",t.locales.edit_notification),e.xp6(2),e.Q6J("ngIf",9===t.notificationPermission&&t.loginUser||!t.loginUser||t.loginUser&&(6===t.loginUser.HOSUserTypeId||7===t.loginUser.HOSUserTypeId))}}function ga(r,l){if(1&r&&(e.TgZ(0,"div")(1,"span"),e._uU(2),e.qZA()()),2&r){const t=l.$implicit,s=e.oxw();e.xp6(2),e.Oqu(s.getHomeBaseName(t.data.HOSHomeBaseId))}}function va(r,l){if(1&r&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&r){const t=e.oxw().$implicit,s=e.oxw();e.xp6(1),e.Oqu(s.fixData(t.data.Emails).join(", "))}}function _a(r,l){if(1&r&&(e._uU(0),e.TgZ(1,"small",30),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit,s=e.oxw();e.AsE(" ",s.fixData(t.data.Emails)[0],", ",s.fixData(t.data.Emails)[1]," "),e.xp6(2),e.AsE("",s.fixData(t.data.Emails).length-2," ",s.locales.more,"")}}function Sa(r,l){if(1&r&&(e.TgZ(0,"div"),e.YNc(1,va,2,1,"span",28),e.YNc(2,_a,3,4,"ng-template",null,29,e.W1O),e.qZA()),2&r){const t=l.$implicit,s=e.MAs(3),i=e.oxw();let o;e.xp6(1),e.Q6J("ngIf",(null==(o=i.fixData(t.data.Emails))?null:o.length)<=2)("ngIfElse",s)}}let Qt=(()=>{class r{constructor(t,s,i){this.hosService=t,this.eventBus=s,this.homeBaseService=i,this.onAdd=new e.vpe,this.onUpdate=new e.vpe,this.onDelete=new e.vpe,this.moaForUser=[],this.notificationsCopy=[],this.loading=!1,this.homeBases=[]}ngOnInit(){this.loginUser=this.hosService.loginUser,this.moaForUser=this.hosService.moaForUser,this.loginUser&&this.getNotificationPermission()}ngOnChanges(t){if(this.hosService.homeBasesAdmin&&(this.homeBases=[...this.hosService.homeBasesAdmin],void 0===this.homeBases.find(i=>-1===i.HOSHomeBaseId))){const i=this.homeBaseService.getPristineHomeBase();i.Name=this.locales.allHomeBases,this.homeBases=[i,...this.hosService.homeBasesAdmin]}this.notifications&&(this.notificationsCopy=[...this.notifications],this.selectedHomeBase=null)}getNotificationPermission(){this.notificationPermission=this.hosService.loginUser.HOSRole.PermissionIds.find(s=>9===s)?9:10}getHomeBaseName(t){if(this.hosService.homeBasesAdmin&&this.hosService.homeBasesAdmin.length>0){let s=this.hosService.homeBasesAdmin.find(i=>i.HOSHomeBaseId===t);return s?s.Name:this.locales.noHomeBase}return this.locales.noHomeBase}homeBaseChange(t){switch(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.notificationsCopy?.length>0&&(this.notifications=[...this.notificationsCopy]),t.value){case void 0:case null:case 0:this.notifications=[...this.notificationsCopy];break;default:this.notifications=this.notifications.filter(s=>s.HOSHomeBaseId===t.value)}this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}fixData(t){return t.split(",")}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(y.T),e.Y36(n.Yd),e.Y36(we.s))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["notification-list"]],inputs:{notifications:"notifications",locales:"locales",currentCarrier:"currentCarrier"},outputs:{onAdd:"onAdd",onUpdate:"onUpdate",onDelete:"onDelete"},features:[e.TTD],decls:24,vars:21,consts:[[1,"container","table-size"],[1,"card","card-default"],[1,"card-header"],[1,"card-title"],[1,"card-tools"],["type","button","class","btn btn-outline-primary",3,"click",4,"ngIf"],[1,"card-body"],["id","gridContainer",3,"dataSource","showBorders","columnHidingEnabled","columnAutoWidth"],[3,"visible","placeholder"],[3,"pageSize"],[3,"enabled"],["location","before","locateInMenu","auto",4,"ngIf"],["name","searchPanel"],["dataField","Name",3,"caption"],["cellTemplate","typeTemplate","dataField","Type","dataType","string",3,"caption"],["dataField","HOSHomeBaseId","cellTemplate","homeBaseTemplate","dataType","string",3,"caption",4,"ngIf"],["dataField","Emails","cellTemplate","emailTemplate",3,"caption"],["cellTemplate","actionsTemplate",3,"width","caption"],[4,"dxTemplate","dxTemplateOf"],["type","button",1,"btn","btn-outline-primary",3,"click"],[1,"fas","fa-plus"],["location","before","locateInMenu","auto"],["displayExpr","Name","valueExpr","HOSHomeBaseId",3,"dataSource","searchMode","searchExpr","searchTimeout","minSearchLength","searchEnabled","showDataBeforeSearch","ngModel","ngModelOptions","width","noDataText","placeholder","onValueChanged","ngModelChange"],["dataField","HOSHomeBaseId","cellTemplate","homeBaseTemplate","dataType","string",3,"caption"],["type","button",1,"btn","btn-link",3,"title","click"],[1,"fas","fa-edit"],["type","button","class","btn btn-link",3,"title","click",4,"ngIf"],[1,"fas","fa-tras
1h-alt"],[4,"ngIf","ngIfElse"],["higher",""],[1,"badge","badge-primary"]],template:function(s,i){1&s&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"h3",3),e._uU(4),e.qZA(),e.TgZ(5,"div",4),e.YNc(6,ca,3,1,"button",5),e.qZA()(),e.TgZ(7,"div",6)(8,"dx-data-grid",7),e._UZ(9,"dxo-search-panel",8)(10,"dxo-paging",9)(11,"dxo-load-panel",10),e.TgZ(12,"dxo-toolbar"),e.YNc(13,ma,2,13,"dxi-item",11),e._UZ(14,"dxi-item",12),e.qZA(),e._UZ(15,"dxi-column",13)(16,"dxi-column",14),e.YNc(17,ua,1,1,"dxi-column",15),e._UZ(18,"dxi-column",16)(19,"dxi-column",17),e.YNc(20,ha,4,3,"div",18),e.YNc(21,fa,4,2,"div",18),e.YNc(22,ga,3,1,"div",18),e.YNc(23,Sa,4,2,"div",18),e.qZA()()()()),2&s&&(e.xp6(4),e.Oqu(i.locales.notifications),e.xp6(2),e.Q6J("ngIf",9===i.notificationPermission&&i.loginUser||!i.loginUser||i.loginUser&&(6===i.loginUser.HOSUserTypeId||7===i.loginUser.HOSUserTypeId)),e.xp6(2),e.Q6J("dataSource",i.notifications)("showBorders",!0)("columnHidingEnabled",!0)("columnAutoWidth",!0),e.xp6(1),e.s9C("placeholder",i.locales.search),e.Q6J("visible",!0),e.xp6(1),e.Q6J("pageSize",15),e.xp6(1),e.Q6J("enabled",i.loading),e.xp6(2),e.Q6J("ngIf",!i.moaForUser||0===i.moaForUser.length),e.xp6(2),e.s9C("caption",i.locales.name),e.xp6(1),e.s9C("caption",i.locales.type),e.xp6(1),e.Q6J("ngIf",!i.moaForUser||0===i.moaForUser.length),e.xp6(1),e.s9C("caption",i.locales.emails),e.xp6(1),e.s9C("caption",i.locales.actions),e.Q6J("width",100),e.xp6(1),e.Q6J("dxTemplateOf","typeTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","actionsTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","homeBaseTemplate"),e.xp6(1),e.Q6J("dxTemplateOf","emailTemplate"))},dependencies:[Q.O5,c.JJ,c.On,Se.e,ee.qvW,ee.ZT3,ee.mKI,ee.sXh,ee.XXE,ee.y1f,pe.p6,Ee._,$t],styles:[".dx-datagrid-content .dx-datagrid-table .dx-row>td, .dx-datagrid-content[_ngcontent-%COMP%] .dx-datagrid-table[_ngcontent-%COMP%] .dx-row[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{vertical-align:inherit!important} .dx-datagrid-headers .dx-datagrid-table .dx-row.dx-header-row td{background-color:#e9ecef!important;color:#000!important;font-weight:600!important}"],changeDetection:0})}return r})();function ba(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"moa-carriers",9),e.NdJ("onAddCarrier",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.openCarrierForm(i))})("onEditCarrier",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.openCarrierForm(!1,i))}),e.ALo(1,"async"),e.qZA()}if(2&r){const t=e.oxw(2);e.Q6J("carriers",e.lcZ(1,3,t.carriers$))("locales",t.locales)("role",t.role)}}function Ca(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",5)(1,"app-driver-list",10),e.NdJ("onActivate",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.activedDriver(i))})("onSendNotification",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.sendDriverNotification(i))})("onSendDriver",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.showDriverForm(i))})("onDriverAdd",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.addDriver(i))})("onUnLockDriver",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.unlockDriver(i))})("refreshDriverData",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.handlerClick(i))}),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("drivers",t.driversAdmin)("locales",t.locales)("carrier",t.currentCarrier)("role",t.role)}}function Ta(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",5)(1,"app-homebase-list",11),e.NdJ("onDelete",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.deleteHomeBase(i))})("onHomeBaseUpdate",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.updateHomeBase(i))})("onHomeBaseAdd",function(){e.CHM(t);const i=e.oxw(2);return e.KtG(i.homeBaseAdd())})("onAssignment",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.driversAssigned(i))}),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("homebases",t.homeBasesAdmin)("drivers",t.hosdriversAdmin)("carrier",t.currentCarrier)("locales",t.locales)}}function ya(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",5)(1,"app-asset-list",12),e.NdJ("onAssetAdd",function(){e.CHM(t);const i=e.oxw(2);return e.KtG(i.addAsset())})("onAssetUpdate",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.updateAsset(i))})("onActivateAsset",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.activateAsset(i))})("refreshAssets",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.handlerClick(i))}),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("assets",t.assetsAdmin)("locales",t.locales)("currentCarrier",t.currentCarrier)("moaForUser",t.moaForUser)}}function Aa(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"div",5)(1,"notification-list",13),e.NdJ("onAdd",function(){e.CHM(t);const i=e.oxw(2);return e.KtG(i.addNotification())})("onUpdate",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.updateNotification(i))})("onDelete",function(i){e.CHM(t);const o=e.oxw(2);return e.KtG(o.deleteNotification(i))}),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("notifications",t.notificationsAdmin)("locales",t.locales)("currentCarrier",t.currentCarrier)}}function Ia(r,l){if(1&r&&(e.TgZ(0,"div",5),e._UZ(1,"support-users",14),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("appSupportUsersList",t.appSupportUsersList)("locales",t.locales)("role",t.role)("currentCarrier",t.currentCarrier)}}function xa(r,l){if(1&r){const t=e.EpF();e.TgZ(0,"section",2)(1,"div",3)(2,"div",4)(3,"div",5)(4,"carrier-list",6),e.NdJ("onItemClick",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.handlerClick(i))})("onCarrierChange",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.carrierChange(i))}
1)("onCarrierUpdate",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.updateCarrier(i))})("onAddCarrier",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.openCarrierForm(i))})("onTableChanged",function(i){e.CHM(t);const o=e.oxw();return e.KtG(o.tableChanged(i))}),e.ALo(5,"async"),e.qZA(),e.YNc(6,ba,2,5,"moa-carriers",7),e.ALo(7,"async"),e.qZA()(),e.TgZ(8,"div",4),e.YNc(9,Ca,2,4,"div",8),e.ALo(10,"async"),e.YNc(11,Ta,2,4,"div",8),e.ALo(12,"async"),e.YNc(13,ya,2,4,"div",8),e.ALo(14,"async"),e.YNc(15,Aa,2,3,"div",8),e.ALo(16,"async"),e.YNc(17,Ia,2,4,"div",8),e.ALo(18,"async"),e.qZA()()()}if(2&r){const t=e.oxw();e.xp6(4),e.Q6J("carriers",e.lcZ(5,11,t.carriers$))("currentCarrier",t.currentCarrier)("locales",t.locales)("items",t.actions)("moaForUser",t.MOAForUser),e.xp6(2),e.Q6J("ngIf","carrierList"===e.lcZ(7,13,t.activeList$)&&t.showCarrierList),e.xp6(3),e.Q6J("ngIf","driverList"===e.lcZ(10,15,t.activeList$)),e.xp6(2),e.Q6J("ngIf","homebaseList"===e.lcZ(12,17,t.activeList$)),e.xp6(2),e.Q6J("ngIf","assetList"===e.lcZ(14,19,t.activeList$)),e.xp6(2),e.Q6J("ngIf","notificationList"===e.lcZ(16,21,t.activeList$)),e.xp6(2),e.Q6J("ngIf","supportList"===e.lcZ(18,23,t.activeList$))}}var be=(()=>{return(r=be||(be={})).emptyList="emptyList",r.driverList="driverList",r.homebaseList="homebaseList",r.assetList="assetList",r.notificationList="notificationList",r.carrierList="carrierList",r.supportList="supportList",be;var r})();let Vt=(()=>{class r{get activeList$(){return this._activeList$.asObservable()}set activeList$(t){this._activeList$.next(t)}constructor(t,s,i,o,a,d,m,v,Z,H,w,L,Y,W,E,G,z,te,j,se,ie,le,K,re){this.localesService=t,this.eventBus=s,this.driverService=i,this.assetService=o,this.homebaseService=a,this.modalService=d,this.hosService=m,this.activatedRoute=v,this.utilService=Z,this.carrierService=H,this.notificationService=w,this.authService=L,this.gurtamService=Y,this.appErrorService=W,this.confirmDialogService=E,this.mapService=G,this.encryptService=z,this.toast=te,this.moaService=j,this.router=se,this.appSupportService=ie,this.userService=le,this.db=K,this.loginService=re,this.currentCarrier=null,this.driversAdmin=null,this.hosdriversAdmin=null,this.homeBasesAdmin=null,this.assetsAdmin=null,this.notificationsAdmin=null,this.notificationTypes=[],this.notificationTableType=null,this.appSupportUsersList=[],this.localesSub=null,this.currentCarrierSub=null,this.driversAdminSub=null,this.driversSub=null,this.HomeBaseSub=null,this.AssetSub=null,this.notificationSub=null,this.showCarrierList=!1,this.alertMessage="",this.moaCarriers=[],this._activeList$=new ye.X(null),this.manageSub=new V.w,this.moaCarriersSub=new V.w,this.moaForUserSubs=new V.w,this.errorToastDurationMs=3e3}ngOnDestroy(){this.localesSub&&this.localesSub.unsubscribe(),this.currentCarrierSub&&this.currentCarrierSub.unsubscribe(),this.driversAdminSub&&this.driversAdminSub.unsubscribe(),this.driversSub&&this.driversSub.unsubscribe(),this.HomeBaseSub&&this.HomeBaseSub.unsubscribe(),this.AssetSub&&this.AssetSub.unsubscribe(),this.notificationSub&&this.notificationSub.unsubscribe(),this.manageSub.unsubscribe(),this.moaCarriersSub.unsubscribe(),this.moaForUserSubs.unsubscribe()}ngOnInit(){this.eventBus.emit(new n.m_(n.zW.HideInitAppSpinner)),this.moaForUser=this.hosService.moaForUser,this.getMOAs(),this.hosService.activeLink$="manage",this.loginUser=this.hosService.loginUser,this.actions=this.utilService.getManageActions(),this.loginUser&&4===this.loginUser.HOSUserTypeId&&this.actions.push({label:"Roles",link:"roles",icon:"fas fa-shield-alt fa-lg"}),this.partnerId=this.authService.appCredentials?.partnerId,this.getPermissions(),this.notificationTypes=this.utilService.getHosNotificationTypes(),this.localesSub=this.localesService.getCurrentLocales().subscribe(a=>{const{locales:d}=a;this.locales={...d},this.notificationTypes=this.notificationTypes.map(m=>(1===m.key&&(m.label=this.locales.unidentified_driving),2===m.key&&(m.label=this.locales.hos_violation),3===m.key&&(m.label=this.locales.eld_malfunction),4===m.key&&(m.label=this.locales.driving_no_ecm),5===m.key&&(m.label=this.locales.dvri_no_compliance),6===m.key&&(m.label=this.locales.dvirDefectsNotification),7===m.key&&(m.label=this.locales.specialMoves),8===m.key&&(m.label=this.locales.noPreTi),9===m.key&&(m.label=this.locales.rejectedCarrierEdit),
110===m.key&&(m.label=this.locales.uploadDriverDocument),m)),this.actions.forEach(m=>{switch(m.link){case"details":m.label=this.locales.details;break;case"drivers":m.label=this.locales.drivers;break;case"homebase":m.label=this.locales.home_bases;break;case"assets":m.label=this.locales.assets;break;case"notification":m.label=this.locales.notifications;break;case"roles":m.label=this.locales.roles}}),this.getAssetsSubtypes()});let t=this.carrierService.getPristineCarrier();t.Name=` -- ${this.locales.select_carrier} -- `,this.carriers$=this.activatedRoute.data.pipe((0,T.w)(a=>{const{carriers:d}=a;return(0,_.of)(null===this.currentCarrier?[t,...d]:[...d])})),this.moaCarriersSub.add((0,U.aj)([this.hosService.carriers$]).subscribe(([a])=>{this.carriers$=(0,_.of)(a?.length>0?[t,...a]:this.hosService.carriers?[t,...this.hosService.carriers]:[t])},()=>{this.carriers$=(0,_.of)([t])})),this.moaForUserSubs.add((0,U.aj)([this.hosService.moaForUser$]).subscribe(([a])=>{this.moaForUser=a;const d=this.actions.find(m=>"support"===m.link);a?.length>0?d&&this.actions.splice(this.actions.indexOf(d),1):void 0===d&&(3===this.role||4===this.role)&&this.actions.push({label:this.locales.appSupportUser,link:"support",icon:"fa fa-users fa-lg"})})),this.activeList$=be.emptyList,this.currentCarrierSub=this.hosService.currentCarrier$.subscribe(a=>{this.currentCarrier=a?Object.assign({},a):null}),this.driversAdminSub=(0,U.aj)([this.hosService.driversAdmin$]).subscribe(([a])=>{this.driversAdmin=a?[...a]:null}),this.HomeBaseSub=(0,U.aj)([this.hosService.homeBasesAdmin$]).subscribe(([a])=>{this.homeBasesAdmin=a?[...a]:null}),this.AssetSub=(0,U.aj)([this.hosService.assetsAdmin$]).subscribe(([a])=>{this.assetsAdmin=a?[...a]:null}),this.notificationSub=(0,U.aj)([this.hosService.notificationsAdmin$]).subscribe(([a])=>{this.notificationsAdmin=a?[...a]:null});const{role:s}=this.authService.appCredentials;this.role=s,_e.n_({category:"manage-init",message:`manage.component ngOnInit: role=${s}, partnerId=${this.authService.appCredentials?.partnerId}, loginUserTypeId=${this.loginUser?.HOSUserTypeId}, carriersCount=${this.hosService.carriers?.length??0}`,level:"info",data:{role:s,partnerId:this.authService.appCredentials?.partnerId,userName:this.authService.appCredentials?.userName,loginURL:this.hosService.loginURL,loginUserTypeId:this.loginUser?.HOSUserTypeId??null,loginUserId:this.loginUser?.HOSUserId??null,loginUserName:this.loginUser?.UserName??null,appResellerExists:!!this.authService.appReseller,appResellerBillingId:this.authService.appReseller?.HOSBillingId??null,appResellerPartnerId:this.authService.appReseller?.HOSPartnerId??null,resellerStatus:this.authService.appReseller?.Status??null,carriersInService:this.hosService.carriers?.length??0,currentCarrierId:this.hosService.currentCarrier?.HOSClientId??null,hasMoaForUser:!!this.hosService.moaForUser?.length}});const{CanadaEnabled:i,DTCEnabled:o}=this.authService.appReseller;this.reseller_CanadaEnabled=i,this.reseller_DTCEnabled=o,this.loginUser?(this.removeItem(),9===this.loginUser.HOSUserTypeId&&(this.moaCarriers=this.hosService.moaForUser[0]?.HOSClients),(!this.moaForUser||0===this.MOAForUser.length)&&(3===this.role||4===this.role||5!==this.partnerId)&&void 0===this.actions.find(d=>"support"===d.link)&&this.actions.push({label:this.locales.appSupportUser,link:"support",icon:"fa fa-users fa-lg"}),this.addStopLogsAction()):5!==s&&void 0===this.actions.find(d=>"support"===d.link)&&this.actions.push({label:this.locales.appSupportUser,link:"support",icon:"fa fa-users fa-lg"}),this.showAlertMessage()}insertClientData(t){return(this.hosService.carriers||[]).forEach(s=>{(t||[]).forEach(i=>{i.HOSClientId===s.HOSClientId&&(i.ActivateDriver=s.ActivateDriver)})}),t}showAlertMessage(){let t={backdrop:"static",keyboard:!1,size:"md",scrollable:!0};const s={role:this.role,partnerId:this.authService.appCredentials?.partnerId,userName:this.authService.appCredentials?.userName,loginURL:this.hosService.loginURL,loginUserTypeId:this.loginUser?.HOSUserTypeId??null,loginUserId:this.loginUser?.HOSUserId??null,loginUserName:this.loginUser?.UserName??null,hosBillingId:this.authService.appReseller?.HOSBillingId??null,hosPartnerId:this.authService.appReseller?.HOSPartnerId??null,resellerStatus:this.authService.appReseller?.Status??null,resellerName:this.authService.appReseller?.ResellerName??null,carriersInService:this.hosService.carriers?.length??0,currentCarrierId:this.hosService.currentCarrier?.HOSClientId??null,hasMoaForUser:!!this.hosService.moaForUser?.length};if(_e.n_({category:"manage-alert",message:"showAlertMessage() called",level:"info",data:s}),this.manageSub.add(this.activatedRoute.data.subscribe(i=>{const o=i?.carriers;if(_e.n_({category:"manage-alert",message:`activatedRoute.data received: ${o?.length??0} carriers, role=${this.role}`,level:"info",data:{carriersFromResolver:o?.length??0,role:this.role,firstCarrierId:o?.[0]?.HOSClientId??null,firstCarrierName:o?.[0]?.Name??o?.[0]?.CarrierName??null}}),(!o||0===o.length)&&1===this.role){_e.uT("No-permissions modal triggered: empty carriers from resolver",{level:"warning",tags:{flow:"manage-alert",alert_type:"noCarrierForUser",partnerId:String(this.authService.appCredentials?.partnerId??""),role:String(this.role)},extra:{...s,resolverCarriersCount:o?.length??0,resolverCarriersNull:null==o}}),this.alertMessage=this.locales.noCarrierForUser;const a=this.modalService.open(at,t);a.componentInstance.locales={...this.locales},a.componentInstance.alertMessage=this.alertMessage,a.componentInstance.showCloseBtn=!0,a.componentInstance.partnerId=this.authService.appCredentials?.partnerId}})),this.loginUser&&this.loginUser.HOSUserTypeId<4&&1===this.authService.appCredentials.role){_e.uT("Carrier-as-reseller modal triggered",{level:"warning",tags:{flow:"manage-alert",alert_type:"carrierAsReseller"},extra:s}),this.alertMessage=this.locales.carrierAsReseller;const i=this.modalService.open(at,t);i.componentInstance.locales={...this.locales},i.componentInstance.alertMessage=this.alertMessage,i.componentInstance.partnerId=this.authService.appCredentials?.partnerId}if(this.loginUser&&this.loginUser.HOSUserTypeId>3&&2===this.authService.appCredentials.role){_e.uT("Reseller-as-carrier modal triggered",{level:"warning",tags:{flow:"manage-alert",alert_type:"resellerAsCarrierError"},extra:s}),this.alertMessage=this.locales.resellerAsCarrierError;const i=this.modalService.open(at,t);i.componentInstance.locales={...this.locales},i.componentInstance.alertMessage=this.alertMessage,i.componentInstance.partnerId=this.authService.appCredentials?.partnerId}}getPermissions(){this.loginUser&&(this.carrierPermission=this.loginUser.HOSRole?.PermissionIds?.f
1ind(t=>1===t||2===t),this.homeBasePermission=this.loginUser.HOSRole?.PermissionIds?.find(t=>3===t||4===t),this.driverPermission=this.loginUser.HOSRole?.PermissionIds?.find(t=>5===t||6===t),this.assetPermission=this.loginUser.HOSRole?.PermissionIds?.find(t=>7===t||8===t),this.notificationPermission=this.loginUser.HOSRole?.PermissionIds?.find(t=>9===t||10===t),this.rolesPermission=this.loginUser.HOSRole?.PermissionIds?.find(t=>31===t||32===t))}removeItem(){const t=this.actions.find(m=>"details"===m.link),s=this.actions.find(m=>"drivers"===m.link),i=this.actions.find(m=>"homebase"===m.link),o=this.actions.find(m=>"assets"===m.link),a=this.actions.find(m=>"notification"===m.link),d=this.actions.find(m=>"roles"===m.link);this.loginUser&&6!==this.loginUser.HOSUserTypeId&&7!==this.loginUser.HOSUserTypeId&&(!this.carrierPermission&&t&&this.actions.splice(this.actions.indexOf(t),1),!this.driverPermission&&s&&this.actions.splice(this.actions.indexOf(s),1),!this.homeBasePermission&&i&&this.actions.splice(this.actions.indexOf(i),1),!this.assetPermission&&o&&this.actions.splice(this.actions.indexOf(o),1),!this.notificationPermission&&a&&this.actions.splice(this.actions.indexOf(a),1),!this.rolesPermission&&d&&this.actions.splice(this.actions.indexOf(d),1))}handlerClick(t){const{action:s,itemData:i,moa:o,fetchLatest:a}=t;if(this.currentCarrier?.HOSClientId!==i?.HOSClientId){let d=Object.assign({},i);this.hosService.changeCarrier(d)}switch(s){case"details":this.activeList$=be.emptyList,o&&o.length>0?(this.moaCarriers=this.hosService.moaForUser[0]?.HOSClients,this.activeList$=be.carrierList,this.showCarrierList=!0):(this.showCarrierList=!1,this.openCarrierForm());break;case"drivers":console.log("[DEBUG-DRIVERS] handlerClick drivers case entered"),console.log("[DEBUG-DRIVERS] currentCarrier:",JSON.stringify(this.currentCarrier)),console.log("[DEBUG-DRIVERS] homeBasesAdmin:",this.hosService.homeBasesAdmin?.length??"null/undefined"),this.activeList$=be.driverList,this.showCarrierList=!1,this.hosService.homeBasesAdmin&&0!==this.hosService.homeBasesAdmin.length?(console.log("[DEBUG-DRIVERS] homeBasesAdmin already populated, calling showDriverList"),this.showDriverList(!1,a)):(console.log("[DEBUG-DRIVERS] homeBasesAdmin is empty, fetching..."),this.manageSub.add(this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe({next:d=>{console.log("[DEBUG-DRIVERS] getHomeBases returned:",d?.length??"null","homebases"),this.hosService.homeBasesAdmin=d,this.hosService.homeBasesAdmin$=d,this.showDriverList()},error:d=>{console.error("[DEBUG-DRIVERS] getHomeBases ERROR:",d)}})));break;case"homebase":this.activeList$=be.homebaseList,this.showCarrierList=!1,this.hosService.homeBasesAdmin&&0!==this.hosService.homeBasesAdmin.length?this.showHomeBaseList():this.manageSub.add(this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(d=>{this.hosService.homeBasesAdmin=d,this.hosService.homeBasesAdmin$=d,this.showHomeBaseList()}));break;case"assets":this.activeList$=be.assetList,this.showCarrierList=!1,this.hosService.homeBasesAdmin&&0!==this.hosService.homeBasesAdmin.length?this.showAssetList(a):this.manageSub.add(this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(d=>{this.hosService.homeBasesAdmin=d,this.hosService.homeBasesAdmin$=d,this.showAssetList()}));break;case"notification":this.activeList$=be.notificationList,this.showCarrierList=!1,this.hosService.homeBasesAdmin&&0!==this.hosService.homeBasesAdmin.length?this.showNotificationList(i):this.manageSub.add(this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(d=>{this.hosService.homeBasesAdmin=d,this.hosService.homeBasesAdmin$=d,this.showNotificationList(i)}));break;case"support":this.activeList$=be.supportList,this.showCarrierList=!1,this.getUsersAppSupportByCarrier();break;case"stopLogs":this.openStopLogsDialog();break;case"fmcsa":this.checkForAvailableDrivers();break;case"aiVision":this.navToAiVision();break;case"impersonateClient":this.triggerGenerateEncryptedToken(i);break;case"roles":this.router.navigate(["/roles"],{queryParams:{carrierId:i.HOSClientId}});break;default:this.activeList$=be.emptyList,this.showCarrierList=!1}}openCarrierForm(t,s){let i={loading:!1,submited:!1,errors:!1,message:""},o=1;o=t||!this.currentCarrier?.HOSClientId||this.currentCarrier?.HOSClientId<=0?1:2;const a=this.modalService.open(tt,{scrollable:!0,size:"lg"});
1a.componentInstance.carrier=s?Object.assign({},s):(this.loginUser&&5===this.loginUser.HOSPartnerId||3===this.role||4===this.role)&&1===o?this.fakeCarrier():Object.assign({},this.currentCarrier),a.componentInstance.role=this.role,a.componentInstance.reseller_CanadaEnabled=this.reseller_CanadaEnabled,a.componentInstance.reseller_DTCEnabled=this.reseller_DTCEnabled,a.componentInstance.locales={...this.locales},a.componentInstance.pToken=2===this.authService.appCredentials?.partnerId,a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(i))),a.componentInstance.formType=o;const d=a.componentInstance.onSubmit.subscribe(m=>{const v=m;this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),i={loading:!0,submited:!1,errors:!1,message:""},a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(i))),this.updateCarrier(m).subscribe({next:Z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let H=[...this.hosService.carriers],{code:w,data:Y}=Z;if(1===w){let W;if(i={loading:!1,submited:!0,errors:!1,message:""},(!this.moaForUser||0===this.moaForUser.length)&&this.hosService.changeCarrierState(!0),this.toast.success(this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),2===o&&(this.hosService.currentCarrier$=Object.assign({},Y),this.hosService.currentCarrier=Object.assign({},Y),this.currentCarrier=Object.assign({},Y)),H=this.hosService.carriers.map(E=>(W=E,E.index===Y.index?Y:E)),1===o&&(H.push(Y),this.hosService.moaForUser?.length>0?this.moaCarriers.push(Y):this.hosService.changeCarrier(Y)),this.hosService.carriers=[...H],this.hosService.carriers$=[...H],this.carriers$=(0,_.of)([...H]),v.HOSClientId<=0&&(!this.hosService.moaForUser||0===this.hosService.moaForUser.length)&&setTimeout(()=>{this.addHomeBaseInNewCarrier(Y)},50),this.hosService.moaForUser?.length>0&&2===o){const E=this.moaCarriers.findIndex(G=>G.HOSClientId===Y.HOSClientId);-1!==E&&(this.moaCarriers[E]=Y)}9===this.loginUser?.HOSUserTypeId&&this.replaceCarrierData(this.moaCarriers,Y)}else i=38===w?{loading:!1,submited:!0,errors:!0,message:this.locales.supportUsernameExists}:4===w?{loading:!1,submited:!0,errors:!0,message:this.locales.api_key_validation}:{loading:!1,submited:!0,errors:!0,message:this.locales.error_trying_update};a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(i)))},error:Z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let L=(0,he.n)(0,this.locales);L.message=this.locales.error500,a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(L)))}})});a.result.finally(()=>d.unsubscribe())}fakeCarrier(){return{index:-1,HOSClientId:0,HOSPartnerId:0,HOSBillingId:0,Name:"",ExternalClientId:0,CarrierId:"",CarrierName:"",CarrierAddress:"",TimeZoneCode:0,CarrierCountry:1,AccountType:0,ApiKey:"",DistanceUnitCode:1,FuelUnitCode:1,PlatformToken:"",DTCCodes:0,ActivateDriver:0,ECMAutomatic:0,ForceAssetSelection:0,ForceECMLinkConnection:0,SupportUserName:"",SupportPassword:"",CanadaEnabled:0,WorkOrderEnabled:0,EnhancedIFTAEnabled:0,CarrierPropInUse:0,HOSAccountId:0,FMCSAEmail:"",FMCSADisplayName:"",FMCSASmtpHost:"",FMCSASmtpPort:0,FMCSASmtpUser:"",FMCSASmtpPassword:"",FMCSAOtpValidatedOn:0,FMCSAOtpValidated:!1,AIVisionEnabled:0}}addHomeBaseInNewCarrier(t){this.mapService.codeAddress(t.CarrierAddress).subscribe(s=>{s.then(i=>{let o={lat:i.results[0].geometry.location.lat().toFixed(4),lng:i.results[0].geometry.location.lng().toFixed(4)};this.showDialogHomeBase(t,o)}).catch(i=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.showDialogHomeBase(t,{lat:0,lng:0})})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.showDialogHomeBase(t,{lat:0,lng:0})})}showDialogHomeBase(t,s){let i=`<span> ${this.locales.confirmationtextHomeBase} </span> <br/>\n <label> ${this.locales.location_name}: </label> <span> Home Terminal </span>\n <label> ${this.locales.address}: </label> ${t.CarrierAddress} </span>\n <label> ${this.locales.latitude}: </label> ${s.lat} </span>\n <label> ${this.locales.longitude}: </label> <span> ${s.lng} </span> \n <label> ${this.locales.timezone}: </label> <span> ${this.getTimeZone(t.TimeZoneCode).label} </span> <br/>
1\n <span> ${this.locales.editHomeBaseLater} </span>`;this.confirmDialogService.confirm(this.locales.pleaseConfirm,i).then(o=>{if(o){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));let a={HOSHomeBaseId:0,HOSClientId:t.HOSClientId,Name:"Home Terminal",Address:t.CarrierAddress,Latitude:s.lat,Longitude:s.lng,DefaultHome:1,TimeZoneCode:this.getTimeZone(t.TimeZoneCode).key,HOSAccountId:this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null};this.manageSub.add(this.homebaseService.addHomeBase(a).subscribe(d=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:m}=d;1===m?this.toast.success(this.locales.homeBaseSaved,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}):this.toast.error(this.locales.errorSaveHomeBase,{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.errorSaveHomeBase,{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0})}))}}).catch(()=>console.log())}carrierChange(t){this.activeList$=be.emptyList,(0,U.aj)([this.carriers$]).pipe((0,x.b)(([i])=>{let o=null;if("object"==typeof t&&null!==t)o=t;else{const a=parseInt(t,10);o=i.find(d=>d.index===a)}this.hosService.changeCarrier(o)})).subscribe().unsubscribe()}updateCarrier(t){const{index:s}=t;return(0,U.aj)([(0,_.of)(this.authService.appCredentials),(0,_.of)(this.authService.appReseller)]).pipe((0,T.w)(([i,o])=>{const{partnerId:a}=i,{HOSBillingId:d}=o;return t.HOSPartnerId||(t.HOSPartnerId=a),t.HOSBillingId||(t.HOSBillingId=d),this.carrierService.updateCarrier(t,s)}))}replaceCarrierData(t,s){if(this.decryptedData=this.encryptService.decryptUsingTripleDES(sessionStorage.getItem("token")),"ERROR"===this.decryptedData)this.router.navigate(["/userlogin"]);else{const i=JSON.parse(this.decryptedData);let o;(this.hosService.loginURL&&1===this.authService.appCredentials.role&&i.carrier||i.user&&9===i.user.HOSUserTypeId)&&(this.hosService.setCarriers(t),this.hosService.currentCarrier=s,this.hosService.currentCarrier$=s,this.carriers$=(0,_.of)(t)),(i.user&&9===i.user.HOSUserTypeId||this.hosService.moaForUser)&&(i.moas[0].HOSClients=[...t],this.hosService.moaForUser=i.moas,this.hosService.moaForUser$=i.moas),o={user:i.user,appCredentials:i.appCredentials,reseller:i.reseller,loginURL:i.loginURL,carrier:t,moas:this.hosService.moaForUser},localStorage.removeItem("navigateTo"),localStorage.removeItem("statusChangeConfirmed");const a=this.encryptService.encryptUsingTripleDES(o,!0);sessionStorage.setItem("token",a),this.moaForUser&&(this.activeList$=be.carrierList,this.showCarrierList=!0)}}showDriverList(t,s){console.log("[DEBUG-DRIVERS] showDriverList() called, fmcsa:",t,"fetchLatest:",s),console.log("[DEBUG-DRIVERS] this.driversAdmin:",this.driversAdmin?.length??"null"),console.log("[DEBUG-DRIVERS] this.currentCarrier:",JSON.stringify(this.currentCarrier)),console.log("[DEBUG-DRIVERS] moaForUser:",this.hosService.moaForUser?.length??"null"),console.log("[DEBUG-DRIVERS] allDrivers:",this.hosService.allDrivers?.length??"null"),console.log("[DEBUG-DRIVERS] homeBasesAdmin:",this.hosService.homeBasesAdmin?.length??"null"),console.log("[DEBUG-DRIVERS] appCredentials:",JSON.stringify(this.authService.appCredentials)),this.driversSub=(0,U.aj)([(0,_.of)([])]).pipe((0,T.w)(([i])=>(console.log("[DEBUG-DRIVERS] switchMap entered"),this.hosService.moaForUser?.length>0&&this.hosService.allDrivers?.length>0?(console.log("[DEBUG-DRIVERS] Using cached allDrivers"),(0,_.of)([...this.hosService.allDrivers])):null===this.driversAdmin||s?(console.log("[DEBUG-DRIVERS] Fetching drivers from API..."),this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),(0,U.aj)([(0,_.of)(this.authService.appCredentials)]).pipe((0,C.g)(300),(0,T.w)(([o])=>{console.log("[DEBUG-DRIVERS] credentials in switchMap:",JSON.stringify(o));const{role:a,partnerId:d}=o;if(console.log("[DEBUG-DRIVERS] role:",a,"partnerId:",d),3===a||4===a)return console.log("[DEBUG-DRIVERS] role 3/4 path -> getHOSDrivers"),this.hosService.getHOSDrivers(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null,s);switch(console.log("[DEBUG-DRIVERS] role not 3/4, checking partnerId switch"),o.partnerId){case 2:return console.log("[DEBUG-DRIVERS] partnerId 2 -> getGurtamDrivers"),this.hosService.getGurtamDrivers(this.currentCarrier);case 5:return console.log("[DEBUG-DRIVERS] partnerId 5 -> getHOSDrivers"),this.hosService.getHOSDrivers(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null,s);default:return console.log("[DEBUG-DRIVERS] default partnerId -> getDriversAdmin"),console.log("[DEBUG-DRIVERS] About to call getDriversAdmin with carrier:",JSON.stringify(this.currentCarrier)),this.hosService.getDriversAdmin(this.currentCarrier)}}))):(console.log("[DEBUG-DRIVERS] Using cached driversAdmin"),(0,_.of)([...this.driversAdmin]))))).subscribe({next:i=>{console.log("[DEBUG-DRIVERS] subscribe next() received",i?.length??"null","drivers"),i=this.insertClientData(i),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.hosService.driversAdmin$=i?[...i]:[],this.hosService.driversAdmin=i?[...i]:[],t&&this.getClientELD
1Info(i)},error:i=>{console.error("[DEBUG-DRIVERS] subscribe error():",i),console.error("[DEBUG-DRIVERS] error type:",typeof i),console.error("[DEBUG-DRIVERS] error stack:",i?.stack),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})}activedDriver(t){const{active:s,HOSDriverId:i,index:o}=t;let a=null;a=this.driversAdmin.find(i>0?d=>d.HOSDriverId===i:(d,m)=>o===m),this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),2===this.authService.appCredentials?.partnerId&&0===i&&this.currentCarrier.ExternalClientId?(0,U.aj)([this.gurtamService.getGurtamSession()]).pipe((0,x.b)(([m])=>{const v=m.getItem(this.currentCarrier.ExternalClientId);if(!v)return void this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let Z=v.getDrivers();this.gurtamService.checkGurtamDriver(a.ExternalDriverId,a.ExternalName,Z).pipe((0,T.w)(w=>{const{gurtamDriver:Y}=w;if(null!==Y)return this.driverService.activedDriver(s,a,o).subscribe(W=>{let{code:E,message:G,data:z}=W;if(1===E){G=this.locales.activated,1===z.IsActive&&this.toast.success(G,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),0===z.IsActive&&this.toast.success(this.locales.deactivated,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0});let te=[];i>0?te=this.driversAdmin.map(j=>j.HOSDriverId===z.HOSDriverId?z:j):(te=this.driversAdmin.map((j,se)=>o===se?z:j),this.gurtamService.updateGurtamDriver(Y,z,this.currentCarrier.ExternalClientId).subscribe()),te=this.insertClientData(te),this.hosService.driversAdmin$=te?[...te]:[],this.hosService.driversAdmin=te?[...te]:[]}else this.toast.error(this.locales.error_trying_update,{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0})}),(0,_.of)(Y);if(this.toast.info(this.locales.driver_removed,{style:this.utilService.infoStyleMsg,duration:3500,dismissible:!0}),null!==this.hosService.hosDrivers){let W=this.hosService.hosDrivers.filter(E=>E.index!=E.index);this.hosService.hosDrivers$=[...W],this.hosService.hosDrivers=[...W]}return this.driversAdmin=this.insertClientData(this.driversAdmin),this.hosService.driversAdmin$=this.driversAdmin.filter(W=>W.index!==a.index),this.hosService.driversAdmin=this.driversAdmin.filter(W=>W.index!==a.index),(0,_.of)(null)})).subscribe({next:()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))},error:w=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}}).unsubscribe()})).subscribe({next:()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))},error:m=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}}).unsubscribe():this.driverService.activedDriver(s,a,o).subscribe({next:d=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let{code:m,message:v,data:Z}=d;if(1===m){v=this.locales.activated,1===Z.IsActive&&this.toast.success(v,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),0===Z.IsActive&&this.toast.success(this.locales.deactivated,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0});let H=[];H=this.driversAdmin.map(i>0?w=>w.HOSDriverId===Z.HOSDriverId?Z:w:(w,L)=>o===L?Z:w),H=this.insertClientData(H),this.hosService.driversAdmin$=H?[...H]:[],this.hosService.driversAdmin=H?[...H]:[],this.hosService.hosDrivers=null,this.hosService.hosDrivers$=null}else this.toast.error(this.locales.error_trying_update,{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0})},error:d=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})}sendDriverNotification(t){let s={loading:!1,submited:!1,errors:!1,message:""};const i=this.modalService.open(ft,{scrollable:!0});i.componentInstance.locales=this.locales,i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s)));const o=i.componentInstance.onSubmit.subscribe(a=>{const{notification:d}=a;this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.driverService.sendNotification({HOSDriverId:t.HOSDriverId,NotificationTitle:d.title,NotificationMessage:d.message}).subscribe({next:v=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),0===v.code?(s={loading:!1,submited:!0,errors:!0,message:this.locales.error_sending_notification},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s)))):1===v.code?(s={loading:!1,submited:!0,errors:!1,message:""},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s))),this.toast.success(this.locales.send_notification,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0})):2===v.code?(s={loading:!1,submited:!0,errors:!0,message:this.locales.error_sending_notificaion_no_driver},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s)))):(s={loading:!1,submited:!0,errors:!0,message:this.locales.error_sending_notification},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s))))},error:v=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),s={loading:!1,submited:!0,errors:!0,message:this.locales.error500},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s)))}})});i.result.finally(()=>o.unsubscribe())}initializeDriver(){return{index:-1,ExternalDriverId:0,Name:"",LastName:"",HOSDriverId:0,HOSClientId:this.currentCarrier?this.currentCarrier.HOSClientId:0,HOSUserName:"",IsActive:0,HOSRuleSetId:0,PersonalUse:0,YardMove:0,Exemption:0,LicenseState:"",LicenseNumber:"",ExternalName:"",Wifi:1,ELDOperatingMode:0,DistanceUnitCode:1,FuelUnitCode:1,Starting24HTime:0,RuleSetTimestamp:0,HOSHomeBaseId:0,TimeZoneCode:0,AllowDriverExemptionSelection:0,JurisdictionCode:3,ExemptionReason:"",TakeDVIRPhotoEnabled:1,DVIRAccess:1,HOSAccountId:0}}addDriver(t){let s={loading:!1,submited:!1,errors:!1,message:""},i=this.initializeDriver();const o=this.modalService.open(it,{scrollable:!0,size:"lg"});o.componentInstance.driver={...i},o.componentInstance.locales=this.locales,o.componentInstance.role=this.role,o.componentInstance.carrier={...this.currentCarrier},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(s))),o.componentInstance.ruleSetList=this.utilService.getRuleSetList(),o.componentInstance.licenseState=this.utilService.licenseState,o.componentInstance.homebasesList=this.hosService.homeBasesAdmin,o.componentInstance.driverPermission=t,o.componentInstance.formType=1;const d=o.componentInstance.onHombeBasesList.subscribe(Z=>{this.hosService.homeBasesAdmin$=[...Z],this.hosService.homeBasesAdmin=[...Z]});o.result.finally(()=>d.unsubscribe());const m=o.componentInstance.onUnLockDriver.subscribe(Z=>
1this.unlockDriver(Z));o.result.finally(()=>m.unsubscribe());const v=o.componentInstance.onSubmit.subscribe(({driver:Z,passwd:H})=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),s={loading:!0,submited:!1,errors:!1,message:""},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(s)));let w=JSON.parse(JSON.stringify(Z));const{ExternalDriverId:Y,ExternalName:W,index:E}=w;2===this.authService.appCredentials?.partnerId&&this.currentCarrier.ExternalClientId?(0,U.aj)([this.gurtamService.getGurtamSession()]).pipe((0,x.b)(([z])=>{const te=z.getItem(this.currentCarrier.ExternalClientId);if(!te)return void this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let j=te.getDrivers();this.gurtamService.checkGurtamDriver(Y,W,j).pipe((0,T.w)(ie=>{const{gurtamDriver:K}=ie;if(null!==K)return this.driverService.insertDriver({...w},H,E).subscribe({next:re=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let{code:ge,data:fe}=re,He=(0,he.n)(ge,this.locales);if(ge===he.I.OK){this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(He)));let $e=fe,xe=this.driversAdmin.map((Oe,De)=>w.index===De?$e:Oe);if(null!==this.hosService.hosDrivers){let Oe=[...this.hosService.hosDrivers,$e];this.hosService.hosDrivers$=[...Oe],this.hosService.hosDrivers=[...Oe]}xe=this.insertClientData(xe),this.hosService.driversAdmin$=xe?[...xe]:[],this.hosService.driversAdmin=xe?[...xe]:[],this.gurtamService.updateGurtamDriver(K,$e,this.currentCarrier.ExternalClientId).subscribe({next:()=>{},error:Oe=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0})}})}else o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(He)))},error:re=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0});let fe=(0,he.n)(0,this.locales);fe.message=this.locales.error500,o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(fe)))}}),(0,_.of)(K);if(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.info(this.locales.driver_removed,{style:this.utilService.infoStyleMsg,duration:3500,dismissible:!0}),null!==this.hosService.hosDrivers){let re=this.hosService.hosDrivers.filter(ge=>ge.index!==w.index);this.hosService.hosDrivers$=[...re],this.hosService.hosDrivers=[...re]}return this.driversAdmin=this.insertClientData(this.driversAdmin),this.hosService.driversAdmin$=this.driversAdmin.filter(re=>re.index!==w.index),this.hosService.driversAdmin=this.driversAdmin.filter(re=>re.index!==w.index),(0,_.of)(null)})).subscribe({next:()=>{},error:ie=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0});let re=(0,he.n)(0,this.locales);re.message=this.locales.error500,o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(re)))}}).unsubscribe()})).subscribe({next:()=>{},error:z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let se=(0,he.n)(0,this.locales);se.message=this.locales.error500,o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(se)))}}).unsubscribe():this.driverService.insertDriver({...w},H,E).subscribe({next:G=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let{code:z,data:j}=G,se=(0,he.n)(z,this.locales);if(z===he.I.OK){this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(se)));let ie=j,le=this.driversAdmin.map((K,re)=>w.index===re?ie:K);if(null!==this.hosService.hosDrivers){let K=[...this.hosService.hosDrivers,ie];this.hosService.moaForUser?.length>0?this.hosService.currentCarrier&&Object.keys(this.hosService.currentCarrier).length>0&&this.hosService.currentCarrier.HOSClientId===ie.HOSClientId&&(this.hosService.hosDrivers$=[...K],this.hosService.hosDrivers=[...K]):(this.hosService.hosDrivers$=[...K],this.hosService.hosDrivers=[...K])}le=this.insertClientData(le),this.hosService.driversAdmin$=le?[...le]:[],this.hosService.driversAdmin=le?[...le]:[],5===this.authService.appCredentials?.partnerId&&(this.hosService.driversAdmin$=le?[...le,ie]:[ie],this.hosService.driversAdmin=le?[...le,ie]:[ie])}else o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(se)))},error:G=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let j=(0,he.n)(0,this.locales);j.message=this.locales.error500,o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(j)))}})});o.result.finally(()=>v.unsubscribe())}showDriverForm(t){const{driver:s,driverPermission:i,disabledActivateDriver:o}=t,a={...s};let d={loading:!1,submited:!1,errors:!1,message:""};const m=this.modalService.open(it,{scrollable:!0,size:"lg"});m.componentInstance.driver={...s},m.componentInstance.locales=this.locales,m.componentInstance.role=this.role,m.componentInstance.carrier={...this.currentCarrier},m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(d))),m.componentInstance.ruleSetList=this.utilService.getRuleSetList(),m.componentInstance.licenseState=this.utilService.licenseState,m.componentInstance.homebasesList=this.hosService.homeBasesAdmin,m.componentInstance.driverPermission=i,m.componentInstance.formType=0===s.HOSDriverId?1:2,m.componentInstance.disabledActivateDriver=o;const Z=m.componentInstance.onHombeBasesList.subscribe(L=>{this.hosService.homeBasesAdmin$=[...L],this.hosService.homeBasesAdmin=[...L]});m.result.finally(()=>Z.unsubscribe());const H=m.componentInstance.onUnLockDriver.subscribe(L=>this.unlockDriver(L));m.result.finally(()=>H.unsubscribe());const w=m.componentInstance.onSubmit.subscribe(({driver:L,passwd:Y})=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),d={loading:!0,submited:!1,errors:!1,message:""},m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(d)));let W=JSON.parse(JSON.stringify(L));const{HOSDriverId:E,ExternalDriverId:G,ExternalName:z,index:te}=W;0===E?2===this.authService.appCredentials?.partnerId&&this.currentCarrier.ExternalClientId?(0,U.aj)([this.gurtamService.getGurtamSession()]).pipe((0,x.b)(([se])=>{const ie=se.getItem(this.currentCarrier.ExternalClientId);if(!ie)return void this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let le=ie.getDrivers();this.gurtamService.checkGurtamDriver(G,z,le).pipe((0,T.w)(re=>{const{gurtamDriver:ve}=re;if(null!==ve)return this.driverService.insertDriver({...W},Y,te).subscribe({next:fe=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));
1let{code:He,data:xe}=fe,Oe=(0,he.n)(He,this.locales);if(He===he.I.OK){this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(Oe)));let De=xe,ke=this.driversAdmin.map((Re,ti)=>W.index===ti?De:Re);if(null!==this.hosService.hosDrivers){let Re=[...this.hosService.hosDrivers,De];this.hosService.hosDrivers$=[...Re],this.hosService.hosDrivers=[...Re]}ke=this.insertClientData(ke),this.hosService.driversAdmin$=ke?[...ke]:[],this.hosService.driversAdmin=ke?[...ke]:[],this.gurtamService.updateGurtamDriver(ve,De,this.currentCarrier.ExternalClientId).subscribe({next:()=>{},error:Re=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0})}})}else if(Oe)m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(Oe)));else{let De=(0,he.n)(0,this.locales);m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(De)))}},error:fe=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0});let xe=(0,he.n)(0,this.locales);xe.message=this.locales.error500,m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(xe)))}}),(0,_.of)(ve);if(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.info(this.locales.driver_removed,{style:this.utilService.infoStyleMsg,duration:3500,dismissible:!0}),null!==this.hosService.hosDrivers){let fe=this.hosService.hosDrivers.filter(He=>He.index!==W.index);this.hosService.hosDrivers$=[...fe],this.hosService.hosDrivers=[...fe]}return this.driversAdmin=this.insertClientData(this.driversAdmin),this.hosService.driversAdmin$=this.driversAdmin.filter(fe=>fe.index!==W.index),this.hosService.driversAdmin=this.driversAdmin.filter(fe=>fe.index!==W.index),(0,_.of)(null)})).subscribe({next:()=>{},error:re=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0});let fe=(0,he.n)(0,this.locales);fe.message=this.locales.error500,m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(fe)))}}).unsubscribe()})).subscribe({next:()=>{},error:se=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let K=(0,he.n)(0,this.locales);K.message=this.locales.error500,m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(K)))}}).unsubscribe():this.driverService.insertDriver({...W},Y,te).subscribe({next:j=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let{code:se,data:le}=j,K=(0,he.n)(se,this.locales);if(se===he.I.OK){this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(K)));let re=le,ge=this.driversAdmin.map((ve,fe)=>W.index===fe?re:ve);if(null!==this.hosService.hosDrivers){let ve=[...this.hosService.hosDrivers,re];this.hosService.hosDrivers$=[...ve],this.hosService.hosDrivers=[...ve]}ge=this.insertClientData(ge),this.hosService.driversAdmin$=ge?[...ge]:[],this.hosService.driversAdmin=ge?[...ge]:[]}else if(K)m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(K)));else{let re=(0,he.n)(0,this.locales);m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(re)))}},error:j=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let le=(0,he.n)(0,this.locales);le.message=this.locales.error500,m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(le)))}}):this.driverService.updateDriver({...W},Y,W.index).subscribe({next:j=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let{code:se,data:le}=j,K=(0,he.n)(se,this.locales);if(se===he.I.OK){this.toast.success(this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),W?.HOSRuleSetId!==a?.HOSRuleSetId&&this.updateRTDBForRulesetChange(a,W),m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(K)));let re=le,ge=this.driversAdmin.map(ve=>ve.HOSDriverId===re.HOSDriverId?re:ve);if(null!==this.hosService.hosDrivers&&this.hosService.hosDrivers?.length>0){let ve=this.hosService.hosDrivers.map(fe=>fe.HOSDriverId===re.HOSDriverId?re:fe);this.hosService.hosDrivers$=[...ve],this.hosService.hosDrivers=[...ve],this.hosService.moaForUser?.length>0&&(this.hosService.allDrivers=[...ge],this.currentCarrier&&Object.keys(this.currentCarrier).length>0&&this.currentCarrier.HOSClientId===re.HOSClientId&&(this.hosService.hosDrivers$=[...ve,re],this.hosService.hosDrivers=[...ve,re]))}ge=this.insertClientData(ge),this.hosService.driversAdmin$=ge?[...ge]:[],this.hosService.driversAdmin=ge?[...ge]:[]}else if(K)m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(K)));else{let re=(0,he.n)(0,this.locales);re.message=this.locales.error_trying_update,m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(re)))}},error:j=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let le=(0,he.n)(0,this.locales);le.message=this.locales.error500,m.componentInstance&&(m.componentInstance.formState=JSON.parse(JSON.stringify(le)))}})});m.result.finally(()=>w.unsubscribe())}updateRTDBForRulesetChange(t,s){const i=this.utilService.getRuleSetName(t?.HOSRuleSetId),o=this.utilService.getRuleSetName(s?.HOSRuleSetId);this.db.list("RULESETS").update(`${s.HOSDriverId}`,{source:1,previousRulesetName:i,previousRulesetId:t.HOSRuleSetId,currentRulesetName:o,currentRulesetId:s.HOSRuleSetId,previousJurisdictionCode:t.JurisdictionCode,currentJurisdictionCode:s.JurisdictionCode,timeStamp:(new Date).getTime()})}unlockDriver(t){this.confirmDialogService.confirm(this.locales.pleaseConfirm,this.locales.unlocking_driver).then(s=>{if(s&&t&&t>0){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));let i=this.driversAdmin.find(o=>o.HOSDriverId===t);this.driverService.unlockDriver(i).subscribe({next:o=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:a}=o;switch(a){case-1:case 0:this.toast.error(this.locales.error_trying_unlock,{style:this.utilService.errorStyleMsg,duration:3500,dismissible:!0});break;case 1:this.toast.success(this.locales.unlocked,{style:this.utilService.successStyleMsg,duration:3500,dismissible:!0})}},error:o=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})}}).catch(()=>console.log())}driversAssigned({drivers:t,homebase:s}){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.homebaseService.assignDriverToHomeBase(t,this.currentCarrier,s,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe({next:i=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:o,data:d}=i;switch(o){case 1:this.toast.success(this.locales.driverAssignedSuccessfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),this.hosService.hosDrivers=null,this.hosService.hosDrivers$=null,this.hosService.getHOSDrivers(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(m=>{m?(this.hosdriversAdmin=[...m],this.hosService.hosDrivers$=[...m],this.hosService.hosDrivers=[...m]):(this.hosdriversAdmin=[],this.hosService.hosDrivers$=[],this.hosService.hosDrivers=[]),this.driversAdmin=this.hosService.driversAdmin?[...this.hosService.driversAdmin]:[];let v=this.driversAdmin.map(Z=>d.find(w=>w.HOSDriverId===Z.HOSDriverId)||Z);v=this.insertClientData(v),this.hosService.driversAdmin$=v?[...v]:[],this.hosService.driversAdmin=v?[...v]:[]});break;case 226:{this.toast.info(this.locales.notAllDriverAssigned,{style:this.utilService.infoStyleMsg,duration:5e3,dismissible:!0});let m=this.driversAdmin?.map(v=>d.find(H=>H.HOSDriverId===v.HOSDriverId)||v);m=this.insertClientData(m),this.hosService.driversAdmin$=m?[...m]:[],this.hosService.driversAdmin=m?[...m]:[];break}default:this.toast.error(this.locales.errorAssigningDrivers,{style:this.utilService.errorStyleMsg,duration:3500,dismissible:!0})}},error:i=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})}showHomeBaseList(){(0,U.aj)([(0,_.of)(this.hosdriversAdmin)]).pipe((0,T.w)(([t])=>(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),(0,U.aj)([(0,_.of)(this.authService.appCredentials)]).pipe((0,T.w)(([s])=>this.hosService.getHOSDrivers(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null))).subscribe({next:s=>{this.hosdriversAdmin=[...s],this.hosService.hosDrivers$=[...s],this.hosService.hosDrivers=[...s]},error:s=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}}),null!==this.homeBasesAdmin&&this.homeBasesAdmin.length>0?(0,_.of)([...this.homeBasesAdmin]):this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).pipe((0,T.w)(s=>(0,_.of)([...s])))))).subscribe({next:t=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.hosService.homeBasesAdmin$=[...t],this.hosService.homeBasesAdmin=[...t]},error:t=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})}homeBaseAdd(){let t=this.homebaseService.getPristineHomeBase(),s={loading:!1,submited:!1,errors:!1,message:""};const i=this.modalService.open(ot,{size:"xl",scrollable:!0});i.componentInstance.drivers=this.hosdriversAdmin?.filter(a=>!!a.IsActive),i.componentInstance.homebase={...t},i.componentInstance.timezones=this.utilService.getTimezones(),i.componentInstance.mainoffice={mainoffice
1:!this.homeBasesAdmin||0===this.homeBasesAdmin.length,disabled:!this.homeBasesAdmin||0===this.homeBasesAdmin.length},i.componentInstance.locales={...this.locales},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s)));const o=i.componentInstance.onSubmit.subscribe(a=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),s={loading:!0,submited:!1,errors:!1,message:""},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s))),a.HOSClientId=this.currentCarrier?this.currentCarrier.HOSClientId:0,this.homebaseService.addHomeBase(a).subscribe({next:d=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let{code:m,data:Z}=d;1===m?(s={loading:!1,submited:!0,errors:!1,message:""},this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s))),1===Z.DefaultHome&&(this.homeBasesAdmin=this.homeBasesAdmin.map(H=>(H.DefaultHome=0,H))),this.homeBasesAdmin=[...this.homeBasesAdmin,Z],this.hosService.homeBasesAdmin$=[...this.homeBasesAdmin],this.hosService.homeBasesAdmin=[...this.homeBasesAdmin]):(s={loading:!1,submited:!0,errors:!0,message:this.locales.error_trying_update},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s))))},error:d=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),s={loading:!1,submited:!0,errors:!1,message:this.locales.error500},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(s)))}})});i.result.finally(()=>o.unsubscribe())}updateHomeBase(t){let s=this.homebaseService.getPristineHomeBase();const o=this.modalService.open(ot,{size:"xl",scrollable:!0});o.componentInstance.homebase={...t},o.componentInstance.locales={...this.locales},o.componentInstance.timezones=this.utilService.getTimezones(),o.componentInstance.mainoffice={mainoffice:!!t.DefaultHome,disabled:!!t.DefaultHome},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!1,errors:!1,message:""})));const a=o.componentInstance.onSubmit.subscribe(d=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));const{HOSClientId:m,HOSHomeBaseId:v}=t,{Name:Z,Address:H,Latitude:w,Longitude:L,DefaultHome:Y,TimeZoneCode:W,HOSAccountId:E}=d;s.HOSClientId=m,s.HOSHomeBaseId=v,s.Name=Z,s.Address=H,s.Latitude=w,s.Longitude=L,s.DefaultHome=Y,s.TimeZoneCode=W,s.HOSAccountId=E;let G={loading:!0,submited:!1,errors:!1,message:""};o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(G))),this.homebaseService.updateHomeBase(s).subscribe({next:z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let{code:te,data:j}=z;const{DefaultHome:se,HOSHomeBaseId:ie}=j;1===te?(this.toast.success(this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!1,message:""}))),1===se&&(this.homeBasesAdmin=this.homeBasesAdmin.map(K=>(K.DefaultHome=0,K))),this.homeBasesAdmin=this.homeBasesAdmin.map(K=>K.HOSHomeBaseId===ie?j:K),this.hosService.homeBasesAdmin$=[...this.homeBasesAdmin],this.hosService.homeBasesAdmin=[...this.homeBasesAdmin],this.hosService.driversAdmin?.length>0&&(this.hosService.driversAdmin.forEach(K=>{K.HOSHomeBaseId===d.HOSHomeBaseId&&(K.TimeZoneCode=+d.TimeZoneCode)}),this.hosService.driversAdmin$=this.hosService.driversAdmin),this.hosService.driverList?.length>0&&this.hosService.driverList.forEach(K=>{K.HOSHomeBaseId===d.HOSHomeBaseId&&(K.TimeZoneCode=+d.TimeZoneCode)}),this.hosService.hosDrivers?.length>0&&(this.hosService.hosDrivers.forEach(K=>{K.HOSHomeBaseId===d.HOSHomeBaseId&&(K.TimeZoneCode=+d.TimeZoneCode)}),this.hosService.hosDrivers$=this.hosService.hosDrivers),this.hosService.allDrivers?.length>0&&this.hosService.allDrivers.forEach(K=>{K.HOSHomeBaseId===d.HOSHomeBaseId&&(K.TimeZoneCode=+d.TimeZoneCode)})):o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!0,message:this.locales.error_trying_update})))},error:z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),G={loading:!1,submited:!0,errors:!1,message:this.locales.error500},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(G)))}})});o.result.finally(()=>a.unsubscribe())}deleteHomeBase(t){const{DefaultHome:s,HOSHomeBaseId:i}=t;s?this.toast.info(this.locales.can_not_delete_default_home_base,{style:this.utilService.infoStyleMsg,duration:3500,dismissible:!0}):(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.homebaseService.deleteHomeBase(i).subscribe(o=>{switch(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),o.d){case 1:this.toast.success(this.locales.deleted_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),this.homeBasesAdmin=this.homeBasesAdmin.filter(a=>a.HOSHomeBaseId!==i),this.hosService.homeBasesAdmin$=[...this.homeBasesAdmin],this.hosService.homeBasesAdmin=[...this.homeBasesAdmin];break;case 67:this.toast.error(this.locales.error_delete_homebase,{style:this.utilService.errorStyleMsg,duration:3500,dismissible:!0});break;case 503:this.toast.error(this.locales.error_delete_homebase_assets,{style:this.utilService.errorStyleMsg,duration:3500,dismissible:!0});break;default:this.toast.error(this.locales.error_trying_delete,{style:this.utilService.errorStyleMsg,duration:3500,dismissible:!0})}},()=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}))}showAssetList(t){(0,U.aj)([(0,_.of)([])]).pipe((0,T.w)(([s])=>(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),null===this.assetsAdmin||t?this.hosService.getAssets(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null):(0,_.of)([...this.assetsAdmin])))).subscribe({next:s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.hosService.assetsAdmin$=[...s]},error:s=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})}addAsset(){let s=this.assetService.getPristineAsset();this.utilService.modalRef=this.modalService.open(Tt,{size:"lg",scrollable:!0}),this.utilService.modalRef.componentInstance.asset=JSON.parse(JSON.stringify(s)),this.utilService.modalRef.componentInstance.locales={...this.locales},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!1,errors:!1,message:""}))),this.utilService.modalRef.componentInstance.isDisabled=!0,this.utilService.modalRef.componentInstance.requiredECM=1==this.currentCarrier?.ForceECMLinkConnection,this.utilService.modalRef.componentInstance.currentCarrier=this.currentCarrier,this.utilService.modalRef.componentInstance.formType=1;const i=this.utilService.modalRef.componentInstance.onSubmit.subscribe(o=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));const{formdata:a}=o;let d={loading:!0,submited:!1,errors:!1,message:""};this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(d))),s.Number=a.assetNumber.toUpperCase(),s.VIN=a.assetVin.toUpperCase(),s.Plate=a.assetPlate.toUpperCase(),s.RegistrationState=a.assetRegState,s.Description=a.assetDescription,s.Type=a.assetType,s.ECMId=a.assetEcmid,s.AdditionalECMId=a.additionalECMId,s.Active=+a.assetActive,s.HOSHomeBaseId=+a.homebase,s.DefaultCustomDVIRtemplateId=+a.customDVIRTemplate,s.HOSAssetSubTypeId=+a.assetSubtype,s.IsCustomDVIRtemplateRestricted=+a.isCustomDVIRtemplateRestricted,s.FuelTypeId=0===a.assetType?+a.FuelTypePrimary:13,this.loginUser&&9===this.loginUser.HOSUserTypeId||this.hosService.moaForUser?.length>0?(s.HOSAccountId=this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null,s.HOSClientId=-1==+a.carrier?0:+a.carrier):a.HOSAccountId=0,this.AssetSub.add(this.assetService.addAsset(s,this.currentCarrier?.HOSClientId,this.assetsAdmin.length).subscribe(m=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let v={loading:!1,submited:!0,errors:!1,message:""};const{code:Z,data:H}=m;switch(Z){case 1:this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),v={loading:!1,submited:!0,errors:!1,message:""},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v))),this.hosService.assetsAdmin$=[...this.assetsAdmin,H],this.hosService.assetsAdmin=[...this.assetsAdmin,H],this.hosService.homeBasesAdmin&&0!==this.hosService.homeBasesAdmin.length?this.showAssetList(!0):this.manageSub.add(this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(w=>{this.hosService.homeBasesAdmin=w,this.hosService.homeBasesAdmin$=w,this.showAssetList()}));break;case 25:v={loading:!1,submited:!1,errors:!0,message:this.locales.asset_vin_duplicated},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)));break;case 26:v={loading:!1,submited:!1,errors:!0,message:this.locales.asset_plate_duplicated},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)));break;case 27:v={loading:!1,submited:!1,errors:!0,message:this.locales.asset_number_duplicated},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)));break;case 23:v={loading:!1,submited:!1,errors:!0,message:this.locales.asset_number_validation},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)));break;case 24:v={loading:!1,submited:!1,errors:!0,message:this.locales.asset_vin_validation},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)));break;case 29:v={loading:!1,submited:!1,errors:!0,message:this.locales.can_not_modify_inactive_asset},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)));break;case 31:v={loading:!1,submited:!1,errors:!0,message:this.locales.tractor_plate_validation},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)));break;default:v={loading:!1,submited:!1,errors:!0,message:this.locales.error_trying_update},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(v)))}},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),d={loading:!1,submited:!1,errors:!0,message:this.locales.error500},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(d)))}))});this.utilService.modalRef.result.finally(()=>i.unsubscribe())}updateAsset(t){this.utilService.modalRef=this.modalService.open(Tt,{size:"lg",scrollable:!0}),this.utilService.modalRef.componentInstance.asset=JSON.parse(JSON.stringify(t)),this.utilService.modalRef.componentInstance.locales={...this.locales},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!1,errors:!1,message:""}))),this.utilService.modalRef.componentInstance.isDisabled=!1,this.utilService.modalRef.componentInstance.requiredECM=1==this.currentCarrier?.ForceECMLinkConnection,this.utilService.modalRef.componentInstance.formType=2,this.utilService.modalRef.componentInstance.currentCarrier=this.currentCarrier;const i=this.utilService.modalRef.componentInstance.onSubmit.subscribe(o=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));const{formdata:a}=o;let d={loading:!0,submited:!1,errors:!1,message:""};this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(d)));let m=this.assetService.getPristineAsset();m.index=t.index,m.AssetId=t.AssetId,m.HOSClientId=t.HOSClientId,m.Number=a.assetNumber.toUpperCase(),m.VIN=a.assetVin.toUpperCase(),m.Plate=a.assetPlate.toUpperCase(),m.RegistrationState=a.assetRegState,m.Description=a.assetDescription,m.Type=a.assetType,m.ECMId=a.assetEcmid,m.AdditionalECMId=a.additionalECMId,m.Active=+a.assetActive,m.HOSHomeBaseId=+a.homebase,m.DefaultCustomDVIRtemplateId=+a.customDVIRTemplate,m.HOSAssetSubTypeId=+a.assetSubtype,m.IsCustomDVIRtemplateRestricted=+a.isCustomDVIRtemplateRestricted,m.FuelTypeId=0===a.assetType?+a.FuelTypePrimary:13,this.loginUser&&9===this.loginUser.HOSUserTypeId||this.hosService.moaForUser?.length>0?(m.HOSAccountId=this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null,m.HOSClientId=-1==+a.carrier?t.HOSClientId:+a.carrier):m.HOSAccountId=0,this.AssetSub.add(this.assetService.updateAsset(m,m.index).subscribe(v=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:Z,data:H}=v;let w={loading:!1,submited:!0,errors:!1,message:""};switch(Z){case 1:this.toast.success(this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),w={loading:!1,submited:!0,errors:!1,message:""},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w))),H&&!H.HOSClientId&&m.HOSClientId&&(H.HOSClientId=m.HOSClientId),this.hosService.assetsAdmin$=this.assetsAdmin.map(L=>L.index===H.index?H:L),this.hosService.assetsAdmin=this.assetsAdmin.map(L=>L.index===H.index?H:L),this.hosService.homeBasesAdmin&&0!==this.hosService.homeBasesAdmin.length?this.showAssetList(!0):this.manageSub.add(this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(L=>{this.hosService.homeBasesAdmin=L,this.hosService.homeBasesAdmin$=L,this.showAssetList()}));break;case 25:w={loading:!1,submited:!1,errors:!0,message:this.locales.asset_vin_duplicated},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;case 26:w={loading:!1,submited:!1,errors:!0,message:this.locales.asset_plate_duplicated},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;case 27:w={loading:!1,submited:!1,errors:!0,message:this.locales.asset_number_duplicated},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;case 23:w={loading:!1,submited:!1,errors:!0,message:this.locales.asset_number_validation},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;case 24:w={loading:!1,submited:!1,errors:!0,message:this.locales.asset_vin_validation},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;case 29:w={loading:!1,submited:!1,errors:!0,message:this.locales.can_not_modify_inactive_asset},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;case 31:w={loading:!1,submited:!1,errors:!0,message:this.locales.tractor_plate_validation},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;case 227:w={loading:!1,submited:!1,errors:!0,message:this.locales.noChangeHomeBaseForAsset},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)));break;default:w={loading:!1,submited:!1,errors:!0,message:this.locales.error_trying_update},this.utilService.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(w)))}},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),d={loading:!1,submited:!1,errors:!0,message:this.locales.error500},this.utilService
1.modalRef?.componentInstance&&(this.utilService.modalRef.componentInstance.formState=JSON.parse(JSON.stringify(d)))}))});this.utilService.modalRef.result.finally(()=>i.unsubscribe())}getAssetsSubtypes(){this.hosService.assetsSubtypes=[{HOSAssetSubTypeId:0,HOSAssetSubTypeName:this.locales.none,HOSAssetTypeId:0,HOSAssetTypeName:this.locales.tractor,Lang:2,LangCode:"EN"},{HOSAssetSubTypeId:1,HOSAssetSubTypeName:this.locales.none,HOSAssetTypeId:1,HOSAssetTypeName:this.locales.trailer,Lang:2,LangCode:"EN"},{HOSAssetSubTypeId:2,HOSAssetSubTypeName:this.locales.flat,HOSAssetTypeId:1,HOSAssetTypeName:this.locales.trailer,Lang:2,LangCode:"EN"},{HOSAssetSubTypeId:3,HOSAssetSubTypeName:this.locales.bus,HOSAssetTypeId:0,HOSAssetTypeName:this.locales.tractor,Lang:2,LangCode:"EN"},{HOSAssetSubTypeId:4,HOSAssetSubTypeName:this.locales.freezerTruck,HOSAssetTypeId:0,HOSAssetTypeName:this.locales.tractor,Lang:2,LangCode:"EN"},{HOSAssetSubTypeId:5,HOSAssetSubTypeName:this.locales.truck,HOSAssetTypeId:0,HOSAssetTypeName:this.locales.tractor,Lang:2,LangCode:"EN"},{HOSAssetSubTypeId:6,HOSAssetSubTypeName:this.locales.trailer,HOSAssetTypeId:1,HOSAssetTypeName:this.locales.trailer,Lang:2,LangCode:"EN"},{HOSAssetSubTypeId:7,HOSAssetSubTypeName:this.locales.crane,HOSAssetTypeId:0,HOSAssetTypeName:this.locales.tractor,Lang:2,LangCode:"EN"}]}activateAsset(t){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.assetService.updateAsset(t,t.index).subscribe(s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:i,data:o}=s;1===i?(this.toast.success(1===t.Active?this.locales.assetActivated:this.locales.assetDeactivated,{style:this.utilService.successStyleMsg,duration:4e3,dismissible:!0}),this.hosService.assetsAdmin$=this.assetsAdmin.map(a=>a.index===o.index?o:a),this.hosService.assetsAdmin=this.assetsAdmin.map(a=>a.index===o.index?o:a)):this.toast.error(1===t.Active?this.locales.errorAssetActivated:this.locales.errorAssetDeactivated,{style:this.utilService.errorStyleMsg,duration:4e3,dismissible:!0})},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0})})}showNotificationList(t){(0,U.aj)([(0,_.of)([])]).pipe((0,T.w)(([s])=>{if(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),null!==this.notificationsAdmin)return(0,_.of)([...this.notificationsAdmin]);if(null===this.driversAdmin||null===this.assetsAdmin)return(0,U.aj)([(0,_.of)(this.authService.appCredentials)]).pipe((0,T.w)(([i])=>(0,U.aj)([this.hosService.getHOSDrivers(t,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null),this.hosService.getAssets(t,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null)])),(0,T.w)(([i,o])=>{i=this.insertClientData(i),this.hosService.driversAdmin$=i?[...i]:[],this.hosService.assetsAdmin$=o?[...o]:[];let a=[];return a=this.hosService.homeBasesAdmin.map(d=>d.HOSHomeBaseId),this.notificationService.getNotifications(t?t.HOSClientId:null,a,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null)}),(0,O.K)(this.appErrorService.handleError));{let i=[];return i=this.hosService.homeBasesAdmin.map(o=>o.HOSHomeBaseId),this.notificationService.getNotifications(t?t.HOSClientId:null,i,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null)}})).subscribe({next:s=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.hosService.notificationsAdmin$=[...s],this.hosService.notificationsAdmin=[...s]},error:s=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})}addNotification(){let s=this.notificationService.getPristineNotification();const i=this.modalService.open(st,{size:"xl",scrollable:!0});i.componentInstance.drivers=[...this.driversAdmin],i.componentInstance.assets=[...this.assetsAdmin],i.componentInstance.tableType=this.notificationTableType,i.componentInstance.notificationTypes=[...this.notificationTypes],i.componentInstance.locales={...this.locales},i.componentInstance.notification={...s},i.componentInstance.currentCarrier=this.currentCarrier,i.componentInstance.moaForUser=this.hosService.moaForUser,i.componentInstance.formType=1,i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!1,errors:!1,message:""})));const o=i.componentInstance.onSubmit.subscribe(a=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));let d={Notification:{HOSNotificationId:0,HOSClientId:this.hosService.currentCarrier?.HOSClientId,Name:a.Name,Type:a.Type,Emails:a.Emails,Drivers:a.Drivers,Assets:a.Assets,HOSHomeBaseId:a.HomeBase,HOSAccountId:a.Account}},m={loading:!0,submited:!1,errors:!1,message:""};i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(m))),this.notificationService.addNotification(d).subscribe({next:v=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:Z,data:H}=v;1===Z?(this.toast.success(this.locales.added_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!1,message:""}
1))),this.hosService.notificationsAdmin$=[...this.notificationsAdmin,H],this.hosService.notificationsAdmin=[...this.notificationsAdmin,H]):i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!0,message:this.locales.error_trying_save})))},error:v=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),m={loading:!1,submited:!0,errors:!0,message:this.locales.error500},i.componentInstance&&(i.componentInstance.formState=JSON.parse(JSON.stringify(m)))}})});i.result.finally(()=>o.unsubscribe())}updateNotification(t){const{HOSNotificationId:s}=t;let i={loading:!1,submited:!1,errors:!1,message:""};s?(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.notificationService.getNotification(s).subscribe({next:o=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const a=this.modalService.open(st,{size:"xl",scrollable:!0});a.componentInstance.drivers=[...this.driversAdmin],a.componentInstance.assets=[...this.assetsAdmin],a.componentInstance.tableType=this.notificationTableType,a.componentInstance.notificationTypes=[...this.notificationTypes],a.componentInstance.locales={...this.locales},a.componentInstance.currentCarrier=this.currentCarrier,a.componentInstance.notification=this.notificationService.formatNotifications(o),a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(i))),a.componentInstance.currentCarrier=this.currentCarrier,a.componentInstance.moaForUser=this.hosService.moaForUser,a.componentInstance.formType=2;const d=a.componentInstance.onSubmit.subscribe(m=>{this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));const{Name:v,Type:Z,Emails:H,Drivers:w,Assets:L,HomeBase:Y,Account:W}=m;let E={loading:!0,submited:!1,errors:!1,message:""};a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(E))),this.notificationService.updateNotification({Notification:{HOSNotificationId:t.HOSNotificationId,HOSClientId:this.hosService.currentCarrier?.HOSClientId,Name:v,Type:Z,Emails:H,Drivers:w,Assets:L,HOSHomeBaseId:Y,HOSAccountId:W}}).subscribe({next:z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:te,data:j}=z;1===te?(this.toast.success(this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!1,message:""}))),this.hosService.notificationsAdmin$=this.notificationsAdmin.map(ie=>ie.HOSNotificationId===j.HOSNotificationId?j:ie),this.hosService.notificationsAdmin=this.notificationsAdmin.map(ie=>ie.HOSNotificationId===j.HOSNotificationId?j:ie)):a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify({loading:!1,submited:!0,errors:!0,message:this.locales.error_trying_save})))},error:z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),E={loading:!1,submited:!0,errors:!0,message:this.locales.error500},a.componentInstance&&(a.componentInstance.formState=JSON.parse(JSON.stringify(E)))}})});a.result.finally(()=>d.unsubscribe())},error:o=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}})):this.toast.info(this.locales.notification_items_validation,{style:this.utilService.infoStyleMsg,duration:3500,dismissible:!0})}deleteNotification(t){this.confirmDialogService.confirm(this.locales.pleaseConfirm,this.locales.deleteNotification+" "+t.Name+"?").then(s=>{s&&(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.notificationService.deleteNotification(t.HOSNotificationId).subscribe({next:i=>{const{code:o}=i;this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),1===o?(this.toast.success(this.locales.deleted_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),this.hosService.notificationsAdmin$=this.notificationsAdmin.filter(a=>a.HOSNotificationId!==t.HOSNotificationId),this.hosService.notificationsAdmin=this.notificationsAdmin.filter(a=>a.HOSNotificationId!==t.HOSNotificationId)):this.toast.error(this.locales.error_trying_update,{style:this.utilService.errorStyleMsg,duration:3500,dismissible:!0})},error:i=>{this.toast.error(this.locales.error500,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}}))}).catch(()=>console.log())}getDismissReason(t){return t===P.If.ESC?"by pressing ESC":t===P.If.BACKDROP_CLICK?"By clicking on a backdrop":`with ${t}`}getHomeBases(){(!this.hosService.driversAdmin||0===this.hosService.driversAdmin.length)&&this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(t=>{this.hosService.homeBasesAdmin=t,this.hosService.homeBasesAdmin$=t})}getTimeZone(t){return this.utilService.Timezones.find(s=>s.key===t)}getMOAs(){this.loginUser&&9===this.loginUser.HOSUserTypeId&&(this.hosService.moaForUser||this.moaService.getMOAById(this.loginUser.HOSAccountId).subscribe(t=>{const{code:s,data:i}=t.d;if(1===s){const o=this.moaService.formatMOA(i,0);this.hosService.moaForUser=[o],this.hosService.carriers=o.HOSClients,this.hosService.carriers$=o.HOSClients,this.hosService.currentCarrier=o.HOSClients[0],this.hosService.currentCarrier$=o.HOSClients[0]}}))}get MOAForUser(){return this.hosService.moaForUser}tableChanged(t){(!this.showCarrierList||t)&&(this.activeList$=be.emptyList),9!==this.loginUser?.HOSUserTypeId&&this.hosService.moaForUser?.length>0&&this.hosService.changeMOA&&(this.activeList$=be.emptyList),this.hosService.changeMOA=!1}getUsersAppSupportByCarrier(){this.hosService.appSupportUsersList&&0!==this.hosService.appSupportUsersList.length?this.appSupportUsersList=this.hosService.appSupportUsersList:(this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.appSupportService.getUsersAppSupportByCarrier(this.currentCarrier?.HOSClientId).subscribe(t=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const{code:s,data:i}=t.d;1===s?(this.appSupportUsersList=i,this.hosService.appSupportUsersList=i):(this.appSupportUsersList=[],this.hosService.appSupportUsersList=[])},()=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.appSupportUsersList=[],this.hosService.appSupportUsersList=[]}))}addStopLogsAction(){let s=(this.currentCarrier?.FMCSAOtpValidatedOn?this.utilService.convertToLocalDate(this.currentCarrier?.FMCSAOtpValidatedOn):null)||"Never";if(this.loginUser&&6===this.loginUser.HOSUserTypeId){let i=(this.actions||[]).findIndex(a=>"stopLogs"===a.link),o=(this.actions||[]).findIndex(a=>"impersonateClient"===a.link);-1===i&&this.actions.push({label:"Stop upload of Audit logs",link:"stopLogs",icon:"far fa-stop-circle"}),-1===o&&this.actions.push({label:"Impersonate",link:"impersonateClient",icon:"fas fa-sign-in-alt"})}this.loginUser&&4===this.loginUser.HOSUserTypeId&&-1===(this.actions||[]).findIndex(o=>"fmcsa"===o.link)&&this.actions.push({label:`SMTP Setting, Last Validated: ${s}`,link:"fmcsa",icon:"icon-fmcsarecords"})}openStopLogsDialog(){this.triggerGetAllUsers()}triggerGetAllUsers(){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.userService.GetAllHOSUsersByAdmin().subscribe(t=>{const{d:s={}}=t||{},{data:i=[],code:o=0}=s||{};this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),1===o&&this.openDialog(i)})}openDialog(t){this.closeDurationModal=!1;let i,s=[];
1s=t.filter(a=>6!==a.HOSUserTypeId);const o=this.modalService.open(At,{size:"lg",scrollable:!0});o.componentInstance.closeDurationModal=this.closeDurationModal,o.componentInstance.locales={...this.locales},o.componentInstance.users=[...s],o.componentInstance.carriers$=this.carriers$,o.componentInstance.submit.subscribe(a=>{const{duration:d=0,level:m=null,carrierId:v=0,userId:Z=0}=a||{};if(a){this.closeDurationModal=!0,o.componentInstance.closeDurationModal=this.closeDurationModal,this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),i=v||Z||"System";let H=this.db.list(`LOGS/STOP_UPLOAD_LOGS/${m}`);this.updateRTDB(H,i,d)}})}updateRTDB(t,s,i){t.update(s,{source:1,status:4,stopUploadLogsUntil:i,timeStamp:(new Date).getTime()}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.info(0!=i?"The upload of audit logs has stopped.":"The upload of audit logs has restarted.")}checkForAvailableDrivers(){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),this.hosService.getHomeBases(this.currentCarrier,this.hosService.moaForUser?this.hosService.moaForUser[0]?.HOSAccountId:null).subscribe(t=>{this.hosService.homeBasesAdmin=t,this.hosService.homeBasesAdmin$=t,t&&0!=t.length?this.showDriverList(!0):(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error("No Homebases found. Please add a Homebase and try again.",{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0}))})}getClientELDInfo(t){this.carrierService.getHOSClientELDInfo(this.currentCarrier?.HOSClientId).subscribe(s=>{const{d:i={}}=s||{};Object.values(i).length>0?this.openFMCSADialog(t,i):(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.toast.error(`${this.currentCarrier.CarrierName} is not registered with FMCSA`,{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0}))})}openFMCSADialog(t,s){let i={loading:!1,submited:!1,errors:!1,message:""};if(t&&0===t.length)return this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),void this.toast.error("No drivers found. Please add a driver and try again.",{style:this.utilService.errorStyleMsg,duration:2500,dismissible:!0});this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));const o=this.modalService.open(fo.T,{size:"lg",scrollable:!0,backdrop:"static"});o.componentInstance.currentCarrier=this.currentCarrier,o.componentInstance.drivers=t,o.componentInstance.ELDInfo=s,o.componentInstance.locales=this.locales,o.componentInstance&&(o.componentInstance.formState=i),this.carrierService.getEffectiveFMCSASmtpStatus(this.currentCarrier.HOSClientId).pipe((0,A.q)(1)).subscribe({next:d=>{o.componentInstance.effectiveSmtpConfigured=d.isConfigured,o.componentInstance.effectiveSmtpSource="carrier"===d.source||"reseller"===d.source?d.source:null},error:d=>{_e.Tb(d||new Error("GetEffectiveFMCSASmtpStatus failed"),{tags:{feature:"fmcsa-smtp",op:"effective-status"},extra:{hosClientId:this.currentCarrier?.HOSClientId}}),this.toast.error(this.locales.smtp_status_load_failed,{style:this.utilService.errorStyleMsg,duration:this.errorToastDurationMs,dismissible:!0})}});const a=o.componentInstance.onSubmit.subscribe(d=>{const{submit:m=!1,email:v=null,displayName:Z=null,host:H=null,port:w=null,emailUser:L=null,password:Y=null}=d||{};this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner)),i={loading:!1,submited:!1,errors:!1,message:""},o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(i)));let W={index:this.currentCarrier.index,HOSClientId:this.currentCarrier.HOSClientId,HOSPartnerId:this.currentCarrier.HOSPartnerId,HOSBillingId:this.currentCarrier.HOSBillingId,Name:this.currentCarrier.Name,ExternalClientId:this.currentCarrier.ExternalClientId,CarrierId:this.currentCarrier.CarrierId,CarrierName:this.currentCarrier.CarrierName,CarrierAddress:this.currentCarrier.CarrierAddress,TimeZoneCode:this.currentCarrier.TimeZoneCode,CarrierCountry:this.currentCarrier.CarrierCountry,AccountType:this.currentCarrier.AccountType,ApiKey:this.currentCarrier.ApiKey,DistanceUnitCode:this.currentCarrier.DistanceUnitCode,FuelUnitCode:this.currentCarrier.FuelUnitCode,PlatformToken:this.currentCarrier.PlatformToken,DTCCodes:this.currentCarrier.DTCCodes,ActivateDriver:this.currentCarrier.ActivateDriver,ECMAutomatic:this.currentCarrier.ECMAutomatic,ForceAssetSelection:this.currentCarrier.ForceAssetSelection,ForceECMLinkConnection:this.currentCarrier.ForceECMLinkConnection,SupportUserName:this.currentCarrier.SupportUserName,SupportPassword:this.currentCarrier.SupportPassword,CanadaEnabled:this.currentCarrier.CanadaEnabled,WorkOrderEnabled:this.currentCarrier.WorkOrderEnabled,EnhancedIFTAEnabled:this.currentCarrier.EnhancedIFTAEnabled,CarrierPropInUse:this.currentCarrier.CarrierPropInUse,HOSAccountId:this.currentCarrier.HOSAccountId,FMCSAEmail:v,FMCSADisplayName:Z,FMCSASmtpHost:H,FMCSASmtpPort:w,FMCSASmtpUser:L};Y&&(W.FMCSASmtpPassword=Y),m&&this.updateCarrier(W).subscribe({next:E=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));
1let{code:G,data:te}=E;1===G&&(this.currentCarrier=te,this.hosService.currentCarrier=te,this.hosService.currentCarrier$=te,i={loading:!1,submited:!0,errors:!1,message:""},this.toast.success(this.locales.updated_successfully,{style:this.utilService.successStyleMsg,duration:2500,dismissible:!0}),o.componentInstance.currentCarrier=this.currentCarrier,o.componentInstance.showConfirmPending())},error:E=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));let te=(0,he.n)(0,this.locales);te.message=this.locales.error500,o.componentInstance&&(o.componentInstance.formState=JSON.parse(JSON.stringify(te)))}})});o.result.finally(()=>a.unsubscribe()),o.componentInstance.otpValidated.subscribe(d=>{const{validated:m=!1}=d||{};if(m){const{role:v=0}=this.authService.appCredentials||{};if(this.hosService.moaForUser&&0!==this.hosService.moaForUser.length)return(0,_.of)(this.hosService.moaForUser[0].HOSClients);3===v||4===v?this.hosService.GetClientsByRole(v).subscribe(Z=>{this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.hosService.carriers=[...Z],this.hosService.carriers$=(0,_.of)([...Z]),this.carriers$=(0,_.of)([...Z]),this.updateTooltip(Z)}):(this.eventBus.emit(new n.m_(n.zW.HideAppSpinner)),this.hosService.getCarriers(this.authService?.appCredentials,this.authService.appReseller).subscribe(Z=>{this.hosService.carriers=[...Z],this.hosService.carriers$=(0,_.of)([...Z]),this.carriers$=(0,_.of)([...Z]),this.updateTooltip(Z)}))}})}updateTooltip(t){let i=(this.currentCarrier?.FMCSAOtpValidatedOn?this.utilService.convertToLocalDate(this.currentCarrier?.FMCSAOtpValidatedOn):null)||"Never",o=(this.actions||[]).findIndex(a=>"fmcsa"===a.link);this.actions[o].label=i}navToAiVision(){window.open("https://aivision.apolloeld.com/","_blank")}triggerGenerateEncryptedToken(t){this.eventBus.emit(new n.m_(n.zW.ShowAppSpinner));const{ApiKey:s=null}=t||{};if(!s)return this.toast.error(this.locales.noApiKey,{style:this.utilService.errorStyleMsg,duration:5e3,dismissible:!0}),void this.eventBus.emit(new n.m_(n.zW.HideAppSpinner));this.loginService.getEncryptedTokenForSSO(s,!0).subscribe(i=>{const{d:o=null}=i||{};o&&window.open(`/userlogin?${o}`,"_blank")}),this.eventBus.emit(new n.m_(n.zW.HideAppSpinner))}static#e=this.\u0275fac=function(s){return new(s||r)(e.Y36(Ut.n),e.Y36(n.Yd),e.Y36(Le.F),e.Y36(ct.d),e.Y36(we.s),e.Y36(P.FF),e.Y36(y.T),e.Y36(Ie.gz),e.Y36(b.f),e.Y36(I.V),e.Y36(go.g),e.Y36(p.e),e.Y36(vo.x),e.Y36(_o.q),e.Y36(S.O),e.Y36(bt),e.Y36(So.C),e.Y36(N.jE),e.Y36(bo.N),e.Y36(Ie.F0),e.Y36(Co),e.Y36(Nt.K),e.Y36(dt.KQ),e.Y36(To.r))};static#t=this.\u0275cmp=e.Xpm({type:r,selectors:[["app-manage"]],viewQuery:function(s,i){if(1&s&&e.Gf(lt,5),2&s){let o;e.iGM(o=e.CRH())&&(i.CarrierListComponentRef=o.first)}},decls:2,vars:1,consts:[["class","content",4,"ngIf"],["aria-live","polite","aria-atomic","true"],[1,"content"],[1,"container-fluid"],[1,"row"],[1,"col-sm-12"],["title","Actions",3,"carriers","currentCarrier","locales","items","moaForUser","onItemClick","onCarrierChange","onCarrierUpdate","onAddCarrier","onTableChanged"],[3,"carriers","locales","role","onAddCarrier","onEditCarrier",4,"ngIf"],["class","col-sm-12",4,"ngIf"],[3,"carriers","locales","role","onAddCarrier","onEditCarrier"],[3,"drivers","locales","carrier","role","onActivate","onSendNotification","onSendDriver","onDriverAdd","onUnLockDriver","refreshDriverData"],[3,"homebases","drivers","carrier","locales","onDelete","onHomeBaseUpdate","onHomeBaseAdd","onAssignment"],[3,"assets","locales","currentCarrier","moaForUser","onAssetAdd","onAssetUpdate","onActivateAsset","refreshAssets"],[3,"notifications","locales","currentCarrier","onAdd","onUpdate","onDelete"],[3,"appSupportUsersList","locales","role","currentCarrier"]],template:function(s,i){1&s&&(e.YNc(0,xa,19,25,"section",0),e._UZ(1,"app-toasts",1)),2&s&&e.Q6J("ngIf",""===i.alertMessage)},dependencies:[Q.O5,yo.y,Jt,lt,Bt,Pt,sa,la,Qt,Q.Ov],styles:[".myCustomModalClass[_ngcontent-%COMP%] .modal-dialog[_ngcontent-%COMP%]{max-width:600px!important}"]})}return r})();var Oa=F(82353),ut=F(41661),Wt=F(34497);F(88426);let Za=(()=>{class r{}return r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=e.oAB({type:r}),r.\u0275inj=e.cJS({imports:[[ee.Q8p,pe.Lz,pe.ie,Wt.Cu],ee.Q8p,pe.ie]}),r})();var Pe=F(18399),wa=F(64761),Na=F(54250),Ha=F(72148),Da=F(17412);const Fa=[Q.ez,P.IJ,c.u5,c.UX,Pe.m,Se.x,Oa.O,ut.e,Za,Me.W,Be.A0,Ee.D];let zt=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({providers:[Le.F,{provide:P.DO,useClass:wa.e},{provide:P.NG,useClass:Na.k},Ha.n,Da.m],imports:[Fa]})}return r})();const Ma=[Q.ez,c.u5,c.UX,Se.x,pe.ie,P.IJ,Pe.m];let jt=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({providers:[I.V,Ot],imports:[Ma]})}return r})();
1var ka=F(58309);const qa=[Q.ez,c.u5,c.UX,P.IJ,Se.x,ut.e,Me.W];let Gt=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({providers:[we.s],imports:[qa]})}return r})();let Ba=(()=>{class r{constructor(){this._loading$=new ye.X(!0),this._loaded$=new ye.X(!1),this._search$=new It.xQ,this._dataset$=new ye.X([]),this._total$=new ye.X(0),this.config={columns:[],data:[],matchFn:()=>{}},this._state={page:1,pageSize:10,searchTerm:"",sortColumn:"",sortDirection:""}}get dataset$(){return this._dataset$.asObservable()}get total$(){return this._total$.asObservable()}get loading$(){return this._loading$.asObservable()}get loaded$(){return this._loaded$.asObservable()}get page(){return this._state.page}get pageSize(){return this._state.pageSize}get searchTerm(){return this._state.searchTerm}set page(t){this._set({page:t})}set pageSize(t){this._set({pageSize:t})}set searchTerm(t){this._set({searchTerm:t})}set sortColumn(t){this._set({sortColumn:t})}set sortDirection(t){this._set({sortDirection:t})}initDataTable(t){this.config=t,this._loading$.next(!0),this._loaded$.next(!1),this._dataset$.next(this.config.data),this._search$.pipe((0,x.b)(()=>this._loading$.next(!0)),(0,x.b)(()=>this._loaded$.next(!1)),(0,xt.b)(100),(0,T.w)(()=>this._search()),(0,C.g)(100),(0,x.b)(()=>this._loading$.next(!1)),(0,x.b)(()=>this._loaded$.next(!0))).subscribe(s=>{this._dataset$.next(s.dataset),this._total$.next(s.total)}),this._search$.next()}_set(t){Object.assign(this._state,t),this._search$.next()}_search(){const{sortColumn:t,sortDirection:s,pageSize:i,page:o,searchTerm:a}=this._state;let d=function Ja(r,l,t){return""===t||""===l?r:[...r].sort((s,i)=>{const o=((r,l)=>r<l?-1:r>l?1:0)(`${s[l]}`,`${i[l]}`);return"asc"===t?o:-o})}(this.config.data,t,s);d=d.filter(v=>this.config.matchFn(v,a));const m=d.length;return d=d.slice((o-1)*i,(o-1)*i+i),(0,_.of)({dataset:d,total:m})}static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275prov=e.Yz7({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})(),Kt=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({providers:[ct.d,Ba],imports:[Q.ez,c.u5,c.UX,P.IJ,Se.x,ut.e,Me.W,Pe.m,Be.A0,Ee.D]})}return r})();const Ea=[Q.ez,c.UX,c.u5,Se.x,P.IJ,Be.A0,Pe.m,Ee.D];let Xt=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({imports:[Ea]})}return r})();const Pa=[];let Ra=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({imports:[Ie.Bz.forChild(Pa),Ie.Bz]})}return r})(),ei=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({imports:[Q.ez,Ra,c.u5,c.UX,Se.x,pe.ie,P.IJ,Be.A0]})}return r})();const Ya=[Q.ez,Pe.m,zt,jt,Gt,Kt,ei,Xt,P.IJ],$a=[{path:"",component:Vt,resolve:{carriers:ka.k}}];let Qa=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({imports:[Ya,Ie.Bz.forChild($a),Ie.Bz,Q.ez,Pe.m,zt,jt,Gt,Kt,ei,Xt,P.IJ]})}return r})(),Va=(()=>{class r{static#e=this.\u0275fac=function(s){return new(s||r)};static#t=this.\u0275mod=e.oAB({type:r});static#i=this.\u0275inj=e.cJS({imports:[Q.ez,Qa]})}return r})()},43015:function(ht,Ge,F){var Q;void 0!==this||window,ht.exports=(Q=function(){try{return F(58459)}catch{}}(),(()=>{"use strict";var Ie={662:function(V,_){var U,T=this&&this.__extends||(U=function(O,A){return(U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,c){e.__proto__=c}||function(e,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f])})(O,A)},function(O,A){if("function"!=typeof A&&null!==A)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");function e(){this.constructor=O}U(O,A),O.prototype=null===A?Object.create(A):(e.prototype=A.prototype,new e)});
1Object.defineProperty(_,"__esModule",{value:!0}),_.CellHookData=_.HookData=void 0;var x=function(O,A,e){this.table=A,this.pageNumber=A.pageNumber,this.pageCount=this.pageNumber,this.settings=A.settings,this.cursor=e,this.doc=O.getDocument()};_.HookData=x;var C=function(O){function A(e,c,f,u,n,g){var b=O.call(this,e,c,g)||this;return b.cell=f,b.row=u,b.column=n,b.section=u.section,b}return T(A,O),A}(x);_.CellHookData=C},790:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0});var T=U(148),x=U(938),C=U(323),O=U(587),A=U(49),e=U(858);_.default=function(c){c.API.autoTable=function(){for(var f,u=[],n=0;n<arguments.length;n++)u[n]=arguments[n];1===u.length?f=u[0]:(console.error("Use of deprecated autoTable initiation"),(f=u[2]||{}).columns=u[0],f.body=u[1]);var g=(0,O.parseInput)(this,f),b=(0,e.createTable)(this,g);return(0,A.drawTable)(this,b),this},c.API.lastAutoTable=!1,c.API.previousAutoTable=!1,c.API.autoTable.previous=!1,c.API.autoTableText=function(f,u,n,g){(0,x.default)(f,u,n,g,this)},c.API.autoTableSetDefaults=function(f){return C.DocHandler.setDefaults(f,this),this},c.autoTableSetDefaults=function(f,u){C.DocHandler.setDefaults(f,u)},c.API.autoTableHtmlToJson=function(f,u){if(void 0===u&&(u=!1),typeof window>"u")return console.error("Cannot run autoTableHtmlToJson in non browser environment"),null;var n=new C.DocHandler(this),g=(0,T.parseHtml)(n,f,window,u,!1),I=g.body;return{columns:g.head[0].map(function(S){return S.content}),rows:I,data:I}},c.API.autoTableEndPosY=function(){console.error("Use of deprecated function: autoTableEndPosY. Use doc.lastAutoTable.finalY instead.");var f=this.lastAutoTable;return f&&f.finalY?f.finalY:0},c.API.autoTableAddPageContent=function(f){return console.error("Use of deprecated function: autoTableAddPageContent. Use jsPDF.autoTableSetDefaults({didDrawPage: () => {}}) instead."),c.API.autoTable.globalDefaults||(c.API.autoTable.globalDefaults={}),c.API.autoTable.globalDefaults.addPageContent=f,this},c.API.autoTableAddPage=function(){return console.error("Use of deprecated function: autoTableAddPage. Use doc.addPage()"),this.addPage(),this}}},938:(V,_)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.default=function(U,T,x,C,O){C=C||{};var A=1.15,e=O.internal.scaleFactor,c=O.internal.getFontSize()/e,f="",u=1;if("middle"!==C.valign&&"bottom"!==C.valign&&"center"!==C.halign&&"right"!==C.halign||(u=(f="string"==typeof U?U.split(/\r\n|\r|\n/g):U).length||1),x+=c*(2-A),"middle"===C.valign?x-=u/2*c*A:"bottom"===C.valign&&(x-=u*c*A),"center"===C.halign||"right"===C.halign){var n=c;if("center"===C.halign&&(n*=.5),f&&u>=1){for(var g=0;g<f.length;g++)O.text(f[g],T-O.getStringUnitWidth(f[g])*n,x),x+=c*A;return O}T-=O.getStringUnitWidth(U)*n}return"justify"===C.halign?O.text(U,T,x,{maxWidth:C.maxWidth||100,align:"justify"}):O.text(U,T,x),O}},200:(V,_)=>{function U(T,x){var C=T>0,O=x||0===x;return C&&O?"DF":C?"S":O?"F":null}Object.defineProperty(_,"__esModule",{value:!0}),_.parseSpacing=_.getFillStyle=_.addTableBorder=_.getStringWidth=void 0,_.getStringWidth=function(T,x,C){return C.applyStyles(x,!0),(Array.isArray(T)?T:[T]).map(function(O){return C.getTextWidth(O)}).reduce(function(O,A){return Math.max(O,A)},0)},_.addTableBorder=function(T,x,C,O){var A=x.settings.tableLineWidth;T.applyStyles({lineWidth:A,lineColor:x.settings.tableLineColor});var c=U(A,!1);c&&T.rect(C.x,C.y,x.getWidth(T.pageSize().width),O.y-C.y,c)},_.getFillStyle=U,_.parseSpacing=function(T,x){var C,O,A,e;if(T=T||x,Array.isArray(T)){if(T.length>=4)return{top:T[0],right:T[1],bottom:T[2],left:T[3]};if(3===T.length)return{top:T[0],right:T[1],bottom:T[2],left:T[1]};if(2===T.length)return{top:T[0],right:T[1],bottom:T[0],left:T[1]};T=1===T.length?T[0]:x}return"object"==typeof T?("number"==typeof T.vertical&&(T.top=T.vertical,T.bottom=T.vertical),"number"==typeof T.horizontal&&(T.right=T.horizontal,T.left=T.horizontal),{left:null!==(C=T.left)&&void 0!==C?C:x,top:null!==(O=T.top)&&void 0!==O?O:x,right:null!==(A=T.right)&&void 0!==A?A:x,bottom:null!==(e=T.bottom)&&void 0!==e?e:x}):("number"!=typeof T&&(T=x),{top:T,right:T,bottom:T,left:T})}},913:function(V,_){var U,T=this&&this.__extends||(U=function(C,O){return(U=Object.
1setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var c in e)Object.prototype.hasOwnProperty.call(e,c)&&(A[c]=e[c])})(C,O)},function(C,O){if("function"!=typeof O&&null!==O)throw new TypeError("Class extends value "+String(O)+" is not a constructor or null");function A(){this.constructor=C}U(C,O),C.prototype=null===O?Object.create(O):(A.prototype=O.prototype,new A)});Object.defineProperty(_,"__esModule",{value:!0}),_.getTheme=_.defaultStyles=_.HtmlRowInput=_.FONT_ROW_RATIO=void 0,_.FONT_ROW_RATIO=1.15;var x=function(C){function O(A){var e=C.call(this)||this;return e._element=A,e}return T(O,C),O}(Array);_.HtmlRowInput=x,_.defaultStyles=function(C){return{font:"helvetica",fontStyle:"normal",overflow:"linebreak",fillColor:!1,textColor:20,halign:"left",valign:"top",fontSize:10,cellPadding:5/C,lineColor:200,lineWidth:0,cellWidth:"auto",minCellHeight:0,minCellWidth:0}},_.getTheme=function(C){return{striped:{table:{fillColor:255,textColor:80,fontStyle:"normal"},head:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},body:{},foot:{textColor:255,fillColor:[41,128,185],fontStyle:"bold"},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1},head:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},body:{},foot:{textColor:255,fillColor:[26,188,156],fontStyle:"bold",lineWidth:0},alternateRow:{}},plain:{head:{fontStyle:"bold"},foot:{fontStyle:"bold"}}}[C]}},259:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.parseCss=void 0;var T=U(200);function x(O,A){var e=C(O,A);if(!e)return null;var c=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);if(!c||!Array.isArray(c))return null;var f=[parseInt(c[1]),parseInt(c[2]),parseInt(c[3])];return 0===parseInt(c[4])||isNaN(f[0])||isNaN(f[1])||isNaN(f[2])?null:f}function C(O,A){var e=A(O);return"rgba(0, 0, 0, 0)"===e||"transparent"===e||"initial"===e||"inherit"===e?null==O.parentElement?null:C(O.parentElement,A):e}_.parseCss=function(O,A,e,c,f){var u={},n=1.3333333333333333,g=x(A,function(M){return f.getComputedStyle(M).backgroundColor});null!=g&&(u.fillColor=g);var b=x(A,function(M){return f.getComputedStyle(M).color});null!=b&&(u.textColor=b);var I=x(A,function(M){return f.getComputedStyle(M).borderTopColor});null!=I&&(u.lineColor=I);var M,q,J,R,k,B,X,S=(J=[(M=c).paddingTop,M.paddingRight,M.paddingBottom,M.paddingLeft],R=96/(72/(q=e)),k=(parseInt(M.lineHeight)-parseInt(M.fontSize))/q/2,B=J.map(function(de){return parseInt(de||"0")/R}),k>(X=(0,T.parseSpacing)(B,0)).top&&(X.top=k),k>X.bottom&&(X.bottom=k),X);S&&(u.cellPadding=S);var p=parseInt(c.borderTopWidth||"");(p=p/n/e)&&(u.lineWidth=p);var y=["left","right","center","justify"];-1!==y.indexOf(c.textAlign)&&(u.halign=c.textAlign),-1!==(y=["middle","bottom","top"]).indexOf(c.verticalAlign)&&(u.valign=c.verticalAlign);var N=parseInt(c.fontSize||"");isNaN(N)||(u.fontSize=N/n);var D=function(M){var q="";return("bold"===M.fontWeight||"bolder"===M.fontWeight||parseInt(M.fontWeight)>=700)&&(q="bold"),"italic"!==M.fontStyle&&"oblique"!==M.fontStyle||(q+="italic"),q}(c);D&&(u.fontStyle=D);var h=(c.fontFamily||"").toLowerCase();return-1!==O.indexOf(h)&&(u.font=h),u}},323:(V,_)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.DocHandler=void 0;var U={},T=function(){function x(C){this.jsPDFDocument=C,this.userStyles={textColor:C.getTextColor?this.jsPDFDocument.getTextColor():0,fontSize:C.internal.getFontSize(),fontStyle:C.internal.getFont().fontStyle,font:C.internal.getFont().fontName}}return x.setDefaults=function(C,O){void 0===O&&(O=null),O?O.__autoTableDocumentDefaults=C:U=C},x.unifyColor=function(C){return Array.isArray(C)?C:"number"==typeof C?[C,C,C]:"string"==typeof C?[C]:null},x.prototype.applyStyles=function(C,O){var A,e,c;void 0===O&&(O=!1),C.fontStyle&&this.jsPDFDocument.setFontStyle&&this.jsPDFDocument.setFontStyle(C.fontStyle);var f=this.jsPDFDocument.internal.getFont(),u=f.fontStyle,n=f.fontName;if(C.font&&(n=C.font),C.fontStyle){u=C.fontStyle;var g=this.getFontList()[n];g&&-1===g.indexOf(u)&&(this.jsPDFDocument.setFontStyle&&this.jsPDFDocument.setFontStyle(g[0]),u=g[0])}if(this.jsPDFDocument.setFont(n,u),C.fontSize&&this.jsPDFDocument.setFontSize(C.fontSize),!O){var b=x.unifyColor(C.fillColor);b&&(A=this.jsPDFDocument).setFillColor.apply(A,b),(b=x.unifyColor(C.textColor))&&(e=this.jsPDFDocument).setTextColor.apply(e,b),(b=x.unifyColor(C.lineColor))&&(c=this.jsPDFDocument).setDrawColor.apply(c,b),"number"==typeof C.lineWidth&&this.jsPDFDocument.setLineWidth(C.lineWidth)}},x.prototype.splitTextToSize=function(C,O,A){return this.jsPDFDocument.splitTextToSize(C,O,A)},x.prototype.rect=function(C,O,A,e,c){return this.jsPDFDocument.rect(C,O,A,e,c)},x.prototype.getLastAutoTable=function(){return this.jsPDFDocument.lastAutoTable||null},x.prototype.getTextWidth=function(C){return this.jsPDFDocument.getTextWidth(C)},x.prototype.getDocument=function(){return this.jsPDFDocument},x.prototype.setPage=function(C){this.jsPDFDocument.setPage(C)},x.prototype.addPage=function(){return this.jsPDFDocument.addPage()},x.prototype.getFontList=function(){return this.jsPDFDocument.getFontList(
vendor: 2,047 bytes, line 1
1)},x.prototype.getGlobalOptions=function(){return U||{}},x.prototype.getDocumentOptions=function(){return this.jsPDFDocument.__autoTableDocumentDefaults||{}},x.prototype.pageSize=function(){var C=this.jsPDFDocument.internal.pageSize;return null==C.width&&(C={width:C.getWidth(),height:C.getHeight()}),C},x.prototype.scaleFactor=function(){return this.jsPDFDocument.internal.scaleFactor},x.prototype.pageNumber=function(){var C=this.jsPDFDocument.internal.getCurrentPageInfo();return C?C.pageNumber:this.jsPDFDocument.internal.getNumberOfPages()},x}();_.DocHandler=T},148:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.parseHtml=void 0;var T=U(259),x=U(913);function C(A,e,c,f,u,n){for(var g=new x.HtmlRowInput(f),b=0;b<f.cells.length;b++){var I=f.cells[b],S=c.getComputedStyle(I);if(u||"none"!==S.display){var p=void 0;n&&(p=(0,T.parseCss)(A,I,e,S,c)),g.push({rowSpan:I.rowSpan,colSpan:I.colSpan,styles:p,_element:I,content:O(I)})}}var y=c.getComputedStyle(f);if(g.length>0&&(u||"none"!==y.display))return g}function O(A){var e=A.cloneNode(!0);return e.innerHTML=e.innerHTML.replace(/\n/g,"").replace(/ +/g," "),e.innerHTML=e.innerHTML.split(/\<br.*?\>/).map(function(c){return c.trim()}).join("\n"),e.innerText||e.textContent||""}_.parseHtml=function(A,e,c,f,u){var n,g,b;void 0===f&&(f=!1),void 0===u&&(u=!1),b="string"==typeof e?c.document.querySelector(e):e;var I=Object.keys(A.getFontList()),S=A.scaleFactor(),p=[],y=[],N=[];if(!b)return console.error("Html table could not be found with input: ",e),{head:p,body:y,foot:N};for(var D=0;D<b.rows.length;D++){var h=b.rows[D],M=null===(g=null===(n=h?.parentElement)||void 0===n?void 0:n.tagName)||void 0===g?void 0:g.toLowerCase(),q=C(I,S,c,h,f,u);q&&("thead"===M?p.push(q):"tfoot"===M?N.push(q):y.push(q))}return{head:p,body:y,foot:N}}},587:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.parseInput=void 0;var T=U(148),x=U(360),C=U(200),O=U(323),A=U(291);function e(c,f,u){var n=c[0]||f[0]||u[0]||[],g=[];return Object.keys(n).filter(function(b){return"_element"!==b}
1).forEach(function(b){var I,S=1;"object"!=typeof(I=Array.isArray(n)?n[parseInt(b)]:n[b])||Array.isArray(I)||(S=I?.colSpan||1);for(var p=0;p<S;p++){var y={dataKey:Array.isArray(n)?g.length:b+(p>0?"_"+p:"")};g.push(y)}}),g}_.parseInput=function(c,f){var u=new O.DocHandler(c),n=u.getDocumentOptions(),g=u.getGlobalOptions();(0,A.default)(u,g,n,f);var b,I=(0,x.assign)({},g,n,f);typeof window<"u"&&(b=window);var S=function(D,h,M){for(var q={styles:{},headStyles:{},bodyStyles:{},footStyles:{},alternateRowStyles:{},columnStyles:{}},J=function(B){if("columnStyles"===B)q.columnStyles=(0,x.assign)({},D[B],h[B],M[B]);else{var me=[D,h,M].map(function(ne){return ne[B]||{}});q[B]=(0,x.assign)({},me[0],me[1],me[2])}},R=0,k=Object.keys(q);R<k.length;R++)J(k[R]);return q}(g,n,f),p=function(D,h,M){for(var q={didParseCell:[],willDrawCell:[],didDrawCell:[],didDrawPage:[]},J=0,R=[D,h,M];J<R.length;J++){var k=R[J];k.didParseCell&&q.didParseCell.push(k.didParseCell),k.willDrawCell&&q.willDrawCell.push(k.willDrawCell),k.didDrawCell&&q.didDrawCell.push(k.didDrawCell),k.didDrawPage&&q.didDrawPage.push(k.didDrawPage)}return q}(g,n,f),y=function(D,h){var M,q,J,R,k,B,X,de,oe,me,ne,ce,ae,Ye,qe,Ze,Ke,Xe,Qe,Ae=(0,C.parseSpacing)(h.margin,40/D.scaleFactor()),Te=null!==(qe=h.startY,Ze=(Ye=
1D).getLastAutoTable(),Ke=Ye.scaleFactor(),Xe=Ye.pageNumber(),Qe=!1,Ze&&Ze.startPageNumber&&(Qe=Ze.startPageNumber+Ze.pageNumber-1===Xe),M="number"==typeof qe?qe:null!=qe&&!1!==qe||!Qe||null==Ze?.finalY?null:Ze.finalY+20/Ke)&&void 0!==M?M:Ae.top;ce=!0===h.showFoot?"everyPage":!1===h.showFoot?"never":null!==(q=h.showFoot)&&void 0!==q?q:"everyPage",ae=!0===h.showHead?"everyPage":!1===h.showHead?"never":null!==(J=h.showHead)&&void 0!==J?J:"everyPage";var Ce=null!==(R=h.useCss)&&void 0!==R&&R,ue=null!==(k=h.horizontalPageBreakRepeat)&&void 0!==k?k:null;return{includeHiddenHtml:null!==(B=h.includeHiddenHtml)&&void 0!==B&&B,useCss:Ce,theme:h.theme||(Ce?"plain":"striped"),startY:Te,margin:Ae,pageBreak:null!==(X=h.pageBreak)&&void 0!==X?X:"auto",rowPageBreak:null!==(de=h.rowPageBreak)&&void 0!==de?de:"auto",tableWidth:null!==(oe=h.tableWidth)&&void 0!==oe?oe:"auto",showHead:ae,showFoot:ce,tableLineWidth:null!==(me=h.tableLineWidth)&&void 0!==me?me:0,tableLineColor:null!==(ne=h.tableLineColor)&&void 0!==ne?ne:200,horizontalPageBreak:!!h.horizontalPageBreak,horizontalPageBreakRepeat:ue}}(u,I),N=function(D,h,M){var q=h.head||[],J=h.body||[],R=h.foot||[];if(h.html)if(M){var B=(0,T.parseHtml)(D,h.html,M,h.includeHiddenHtml,h.useCss)||{};q=B.head||q,J=B.body||q,R=B.foot||q}else console.error("Cannot parse html in non browser environment");return{columns:h.columns||e(q,J,R),head:q,body:J,foot:R}}(u,I,b);return{id:f.tableId,content:N,hooks:p,styles:S,settings:y}}},291:(V,_)=>{function U(T){T.rowHeight?(console.error("Use of deprecated style rowHeight. It is renamed to minCellHeight."),T.minCellHeight||(T.minCellHeight=T.rowHeight)):T.columnWidth&&(console.error("Use of deprecated style columnWidth. It is renamed to cellWidth."),T.cellWidth||(T.cellWidth=T.columnWidth))}Object.defineProperty(_,"__esModule",{value:!0}),_.default=function(T,x,C,O){for(var A=function(f){f&&"object"!=typeof f&&console.error("The options parameter should be of type object, is: "+typeof f),void 0!==f.extendWidth&&(f.tableWidth=f.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),void 0!==f.margins&&(void 0===f.margin&&(f.margin=f.margins),console.error("Use of deprecated option: margins, use margin instead.")),f.startY&&"number"!=typeof f.startY&&(console.error("Invalid value for startY option",f.startY),delete f.startY),!f.didDrawPage&&(f.afterPageContent||f.beforePageContent||f.afterPageAdd)&&(console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use didDrawPage instead"),f.didDrawPage=function(S){T.applyStyles(T.userStyles),f.beforePageContent&&f.beforePageContent(S),T.applyStyles(T.userStyles),f.afterPageContent&&f.afterPageContent(S),T.applyStyles(T.userStyles),f.afterPageAdd&&S.pageNumber>1&&S.afterPageAdd(S),T.applyStyles(T.userStyles)}),["createdHeaderCell","drawHeaderRow","drawRow","drawHeaderCell"].forEach(function(S){f[S]&&console.error('The "'+S+'" hook has changed in version 3.0, check the changelog for how to migrate.')}),[["showFoot","showFooter"],["showHead","showHeader"],["didDrawPage","addPageContent"],["didParseCell","createdCell"],["headStyles","headerStyles"]].forEach(function(S){var p=S[0],y=S[1];f[y]&&(console.error("Use of deprecated option "+y+". Use "+p+" instead"),f[p]=f[y])}),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(S){var p="string"==typeof S?S:S[0],y="string"==typeof S?S:S[1];void 0!==f[p]&&(void 0===f.styles[y]&&(f.styles[y]=f[p]),console.error("Use of deprecated option: "+p+", use the style "+y+" instead."))});for(var u=0,n=["styles","bodyStyles","headStyles","footStyles"];u<n.length;u++)U(f[n[u]]||{});for(var g=f.columnStyles||{},b=0,I=Object.keys(g);b<I.length;b++)U(g[I[b]]||{})},e=0,c=[x,C,O];e<c.length;e++)A(c[e])}},287:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.Column=_.Cell=_.Row=_.Table=void 0;var T=U(913),x=U(662),C=U(200),O=function(){function f(u,n){this.pageNumber=1,this.pageCount=1,this.id=u.id,this.settings=u.settings,this.styles=u.styles,this.hooks=u.hooks,this.columns=n.columns,this.head=n.head,this.body=n.body,this.foot=n.foot}return f.prototype.getHeadHeight=function(u){return this.head.reduce(function(n,g){return n+g.getMaxCellHeight(u)},0)},f.prototype.getFootHeight=function(u){return this.foot.reduce(function(n,g){return n+g.getMaxCellHeight(u)},0)},f.prototype.allRows=function(){return this.head.concat(this.body).concat(this.foot)},f.prototype.callCellHooks=function(u,n,g,b,I,S){for(var p=0,y=n;p<y.length;p++){var N=!1===(0,y[p])(new x.CellHookData(u,this,g,b,I,S));if(g.text=Array.isArray(g.text)?g.text:[g.text],N)return!1}return!0},f.prototype.callEndPageHooks=function(u,n){u.applyStyles(u.userStyles);for(var g=0,b=this.hooks.didDrawPage;g<b.length;g++)(0,b[g])(new x.HookData(u,this,n))},f.prototype.getWidth=function(u){if("number"==typeof this.settings.tableWidth)return this.settings.tableWidth;if("wrap"===this.settings.tableWidth)return this.columns.reduce(function(g,b){return g+b.wrappedWidth},0);var n=this.settings.margin;
1return u-n.left-n.right},f}();_.Table=O;var A=function(){function f(u,n,g,b,I){void 0===I&&(I=!1),this.height=0,this.raw=u,u instanceof T.HtmlRowInput&&(this.raw=u._element,this.element=u._element),this.index=n,this.section=g,this.cells=b,this.spansMultiplePages=I}return f.prototype.getMaxCellHeight=function(u){var n=this;return u.reduce(function(g,b){var I;return Math.max(g,(null===(I=n.cells[b.index])||void 0===I?void 0:I.height)||0)},0)},f.prototype.hasRowSpan=function(u){var n=this;return u.filter(function(g){var b=n.cells[g.index];return!!b&&b.rowSpan>1}).length>0},f.prototype.canEntireRowFit=function(u,n){return this.getMaxCellHeight(n)<=u},f.prototype.getMinimumRowHeight=function(u,n){var g=this;return u.reduce(function(b,I){var S=g.cells[I.index];if(!S)return 0;var p=S.styles.fontSize/n.scaleFactor()*T.FONT_ROW_RATIO,y=S.padding("vertical")+p;return y>b?y:b},0)},f}();_.Row=A;var e=function(){function f(u,n,g){var b,I;this.contentHeight=0,this.contentWidth=0,this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.height=0,this.x=0,this.y=0,this.styles=n,this.section=g,this.raw=u;var S=u;null==u||"object"!=typeof u||Array.isArray(u)?(this.rowSpan=1,this.colSpan=1):(this.rowSpan=u.rowSpan||1,this.colSpan=u.colSpan||1,S=null!==(I=null!==(b=u.content)&&void 0!==b?b:u.title)&&void 0!==I?I:u,u._element&&(this.raw=u._element)),this.text=(null!=S?""+S:"").split(/\r\n|\r|\n/g)}return f.prototype.getTextPos=function(){var u,n;if("top"===this.styles.valign)u=this.y+this.padding("top");else if("bottom"===this.styles.valign)u=this.y+this.height-this.padding("bottom");else{var g=this.height-this.padding("vertical");u=this.y+g/2+this.padding("top")}if("right"===this.styles.halign)n=this.x+this.width-this.padding("right");else if("center"===this.styles.halign){var b=this.width-this.padding("horizontal");n=this.x+b/2+this.padding("left")}else n=this.x+this.padding("left");return{x:n,y:u}},f.prototype.getContentHeight=function(u){var n=(Array.isArray(this.text)?this.text.length:1)*(this.styles.fontSize/u*T.FONT_ROW_RATIO)+this.padding("vertical");return Math.max(n,this.styles.minCellHeight)},f.prototype.padding=function(u){var n=(0,C.parseSpacing)(this.styles.cellPadding,0);return"vertical"===u?n.top+n.bottom:"horizontal"===u?n.left+n.right:n[u]},f}();_.Cell=e;var c=function(){function f(u,n,g){this.wrappedWidth=0,this.minReadableWidth=0,this.minWidth=0,this.width=0,this.dataKey=u,this.raw=n,this.index=g}return f.prototype.getMaxCustomCellWidth=function(u){for(var n=0,g=0,b=u.allRows();g<b.length;g++){var I=b[g].cells[this.index];I&&"number"==typeof I.styles.cellWidth&&(n=Math.max(n,I.styles.cellWidth))}return n},f}();_.Column=c},360:(V,_)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.assign=void 0,_.assign=function(U,T,x,C,O){if(null==U)throw new TypeError("Cannot convert undefined or null to object");for(var A=Object(U),e=1;e<arguments.length;e++){var c=arguments[e];if(null!=c)for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(A[f]=c[f])}return A}},858:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.createTable=void 0;var T=U(323),x=U(287),C=U(189),O=U(913),A=U(360);function e(u,n,g,b,I,S){var p={};return n.map(function(y,N){for(var D=0,h={},M=0,q=0,J=0,R=g;J<R.length;J++){var k=R[J];if(null==p[k.index]||0===p[k.index].left)if(0===q){var B,X={};"object"!=typeof(B=Array.isArray(y)?y[k.index-M-D]:y[k.dataKey])||Array.isArray(B)||(X=B?.styles||{});var de=f(u,k,N,I,b,S,X),oe=new x.Cell(B,de,u);h[k.dataKey]=oe,h[k.index]=oe,p[k.index]={left:oe.rowSpan-1,times:q=oe.colSpan-1}}else q--,M++;else p[k.index].left--,q=p[k.index].times,D++}return new x.Row(y,N,u,h)})}function c(u,n){var g={};return u.forEach(function(b){if(null!=b.raw){var I=function(S,p){if("head"===S){if("object"==typeof p)return p.header||p.title||null;if("string"==typeof p||"number"==typeof p)return p}else if("foot"===S&&"object"==typeof p)return p.footer;return null}(n,b.raw);null!=I&&(g[b.dataKey]=I)}}),Object.keys(g).length>0?g:null}function f(u,n,g,b,I,S,p){var y,N=(0,O.getTheme)(b);"head"===u?y=I.headStyles:"body"===u?y=I.bodyStyles:"foot"===u&&(y=I.footStyles);var D=(0,A.assign)({},N.table,N[u],I.styles,y),M="body"===u&&(I.columnStyles[n.dataKey]||I.columnStyles[n.index])||{},q="body"===u&&g%2==0?(0,A.assign)({},N.alternateRow,I.alternateRowStyles):{},J=(0,O.defaultStyles)(S),R=(0,A.assign)({},J,D,q,M);return(0,A.assign)(R,p)}_.createTable=function(u,n){var g=new T.DocHandler(u),b=function(S,p){var D,y=S.content,N=y.columns.map(function(J,R){var k,B,
1X;return X="object"==typeof J&&null!==(B=null!==(k=J.dataKey)&&void 0!==k?k:J.key)&&void 0!==B?B:R,new x.Column(X,J,R)});0===y.head.length&&(D=c(N,"head"))&&y.head.push(D),0===y.foot.length&&(D=c(N,"foot"))&&y.foot.push(D);var h=S.settings.theme,M=S.styles;return{columns:N,head:e("head",y.head,N,M,h,p),body:e("body",y.body,N,M,h,p),foot:e("foot",y.foot,N,M,h,p)}}(n,g.scaleFactor()),I=new x.Table(n,b);return(0,C.calculateWidths)(g,I),g.applyStyles(g.userStyles),I}},49:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.addPage=_.drawTable=void 0;var T=U(913),x=U(200),C=U(287),O=U(323),A=U(360),e=U(938),c=U(435);function f(S,p,y){var N=S.styles.fontSize/y.scaleFactor()*T.FONT_ROW_RATIO,D=S.padding("vertical"),h=Math.floor((p-D)/N);return Math.max(0,h)}function u(S,p,y,N,D,h,M){var R,k,X,de,oe,q=(R=S,X=h,de=(k=p).settings.margin.bottom,("everyPage"===(oe=k.settings.showFoot)||"lastPage"===oe&&N)&&(de+=k.getFootHeight(k.columns)),R.pageSize().height-X.y-de);if(y.canEntireRowFit(q,M))n(S,p,y,h,M);else if(function(R,k,B,X){var de=R.pageSize().height,oe=X.settings.margin,me=de-(oe.top+oe.bottom);"body"===k.section&&(me-=X.getHeadHeight(X.columns)+X.getFootHeight(X.columns));var ne=k.getMinimumRowHeight(X.columns,R),ce=ne<B;if(ne>me)return console.error("Will not be able to print row "+k.index+" correctly since it's minimum height is larger than page height"),!0;if(!ce)return!1;var ae=k.hasRowSpan(X.columns);return k.getMaxCellHeight(X.columns)>me?(ae&&console.error("The content of row "+k.index+" will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported."),!0):!ae&&"avoid"!==X.settings.rowPageBreak}(S,y,q,p)){var J=function(R,k,B,X){var de={};R.spansMultiplePages=!0,R.height=0;for(var oe=0,me=0,ne=B.columns;me<ne.length;me++){var ce=ne[me];if(ue=R.cells[ce.index]){Array.isArray(ue.text)||(ue.text=[ue.text]);var ae=new C.Cell(ue.raw,ue.styles,ue.section);(ae=(0,A.assign)(ae,ue)).text=[];var Ae=f(ue,k,X);ue.text.length>Ae&&(ae.text=ue.text.splice(Ae,ue.text.length));var Te=X.scaleFactor();ue.contentHeight=ue.getContentHeight(Te),ue.contentHeight>=k&&(ue.contentHeight=k,ae.styles.minCellHeight-=k),ue.contentHeight>R.height&&(R.height=ue.contentHeight),ae.contentHeight=ae.getContentHeight(Te),ae.contentHeight>oe&&(oe=ae.contentHeight),de[ce.index]=ae}}var Ce=new C.Row(R.raw,-1,R.section,de,!0);Ce.height=oe;for(var Ue=0,Ne=B.columns;Ue<Ne.length;Ue++){var ue;(ae=Ce.cells[(ce=Ne[Ue]).index])&&(ae.height=Ce.height),(ue=R.cells[ce.index])&&(ue.height=R.height)}return Ce}(y,q,p,S);n(S,p,y,h,M),b(S,p,D,h,M),u(S,p,J,N,D,h,M)}else b(S,p,D,h,M),u(S,p,y,N,D,h,M)}function n(S,p,y,N,D){N.x=p.settings.margin.left;for(var h=0,M=D;h<M.length;h++){var q=M[h],J=y.cells[q.index];if(J)if(S.applyStyles(J.styles),J.x=N.x,J.y=N.y,!1!==p.callCellHooks(S,p.hooks.willDrawCell,J,y,q,N)){g(S,J,N);var R=J.getTextPos();(0,e.default)(J.text,R.x,R.y,{halign:J.styles.halign,valign:J.styles.valign,maxWidth:Math.ceil(J.width-J.padding("left")-J.padding("right"))},S.getDocument()),p.callCellHooks(S,p.hooks.didDrawCell,J,y,q,N),N.x+=q.width}else N.x+=q.width;else N.x+=q.width}N.y+=y.height}function g(S,p,y){var N=p.styles;if("number"==typeof N.lineWidth){var D=(0,x.getFillStyle)(N.lineWidth,N.fillColor);D&&S.rect(p.x,y.y,p.width,p.height,D)}else if("object"==typeof N.lineWidth){S.rect(p.x,y.y,p.width,p.height,"F");var h=Object.keys(N.lineWidth),M=N.lineWidth;h.map(function(q){var J=(0,x.getFillStyle)(M[q],N.fillColor);!function(R,k,B,X,de,oe){var me,ne,ce,ae;switch(X){case"top":me=B.x,ne=B.y,ce=B.x+k.width,ae=B.y;break;case"left":me=B.x,ne=B.y,ce=B.x,ae=B.y+k.height;break;case"right":me=B.x+k.width,ne=B.y,ce=B.x+k.width,ae=B.y+k.height;break;default:me=B.x,ne=B.y+k.height-oe,ce=B.x+k.width,ae=B.y+k.height-oe}R.getDocument().setLineWidth(oe),R.getDocument().line(me,ne,ce,ae,de)}(S,p,y,q,J||"S",M[q])})}}function b(S,p,y,N,D){void 0===D&&(D=[]),S.applyStyles(S.userStyles),"everyPage"===p.settings.showFoot&&p.foot.forEach(function(M){return n(S,p,M,N,D)}),p.callEndPageHooks(S,N);var h=p.settings.margin;(0,x.addTableBorder)(S,p,y,N),I(S),p.pageNumber++,p.pageCount++,N.x=h.left,N.y=h.top,y.y=h.top,"everyPage"===p.settings.showHead&&p.head.forEac
1h(function(M){return n(S,p,M,N,D)})}function I(S){var p=S.pageNumber();S.setPage(p+1),S.pageNumber()===p&&S.addPage()}_.drawTable=function(S,p){var y=p.settings,N=y.startY,D=y.margin,h={x:D.left,y:N},M=p.getHeadHeight(p.columns)+p.getFootHeight(p.columns),q=N+D.bottom+M;"avoid"===y.pageBreak&&(q+=p.allRows().reduce(function(k,B){return k+B.height},0));var J=new O.DocHandler(S);("always"===y.pageBreak||null!=y.startY&&q>J.pageSize().height)&&(I(J),h.y=D.top);var k,B,X,de,R=(0,A.assign)({},h);p.startPageNumber=J.pageNumber(),!0===y.horizontalPageBreak?(X=R,de=h,c.default.calculateAllColumnsCanFitInPage(k=J,B=p).map(function(oe,me){var ne,ce,ae,Ae,Te;k.applyStyles(k.userStyles),me>0?b(k,B,X,de,oe.columns):(ae=de,Ae=oe.columns,Te=(ce=B).settings,(ne=k).applyStyles(ne.userStyles),("firstPage"===Te.showHead||"everyPage"===Te.showHead)&&ce.head.forEach(function(Ce){return n(ne,ce,Ce,ae,Ae)})),function(ne,ce,ae,Ae,Te){ne.applyStyles(ne.userStyles),ce.body.forEach(function(Ce,Ue){u(ne,ce,Ce,Ue===ce.body.length-1,ae,Ae,Te)})}(k,B,X,de,oe.columns),function(ne,ce,ae,Ae){var Te=ce.settings;ne.applyStyles(ne.userStyles),("lastPage"===Te.showFoot||"everyPage"===Te.showFoot)&&ce.foot.forEach(function(Ce){return n(ne,ce,Ce,ae,Ae)})}(k,B,de,oe.columns)})):(J.applyStyles(J.userStyles),"firstPage"!==y.showHead&&"everyPage"!==y.showHead||p.head.forEach(function(k){return n(J,p,k,h,p.columns)}),J.applyStyles(J.userStyles),p.body.forEach(function(k,B){u(J,p,k,B===p.body.length-1,R,h,p.columns)}),J.applyStyles(J.userStyles),"lastPage"!==y.showFoot&&"everyPage"!==y.showFoot||p.foot.forEach(function(k){return n(J,p,k,h,p.columns)})),(0,x.addTableBorder)(J,p,R,h),p.callEndPageHooks(J,h),p.finalY=h.y,S.lastAutoTable=p,S.previousAutoTable=p,S.autoTable&&(S.autoTable.previous=p),J.applyStyles(J.userStyles)},_.addPage=b},435:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0});var T=U(200),x=function(O,A){var e=(0,T.parseSpacing)(A.settings.margin,0);return O.pageSize().width-(e.left+e.right)},C=function(O,A,e){void 0===e&&(e={});var c=x(O,A),f=A.settings.horizontalPageBreakRepeat,u=null,n=[],g=[],b=A.columns.length,I=e&&e.start?e.start:0;for(null!=f&&(u=A.columns.find(function(p){return p.dataKey===f||p.index===f}))&&(n.push(u.index),g.push(A.columns[u.index]),c-=u.wrappedWidth);I<b;)if(u?.index!==I){var S=A.columns[I].wrappedWidth;if(c<S){0!==I&&I!==e.start||(n.push(I),g.push(A.columns[I]));break}n.push(I),g.push(A.columns[I]),c-=S,I++}else I++;return{colIndexes:n,columns:g,lastIndex:I}};_.default={getColumnsCanFitInPage:C,calculateAllColumnsCanFitInPage:function(O,A){for(var e=[],c=0,f=A.columns.length;c<f;){var u=C(O,A,{start:0===c?0:c});u&&u.columns&&u.columns.length?(c=u.lastIndex,e.push(u)):c++}return e},getPageAvailableWidth:x}},189:(V,_,U)=>{Object.defineProperty(_,"__esModule",{value:!0}),_.ellipsize=_.resizeColumns=_.calculateWidths=void 0;var T=U(200),x=U(435);function C(A,e,c){for(var f=e,u=A.reduce(function(N,D){return N+D.wrappedWidth},0),n=0;n<A.length;n++){var g=A[n],I=g.width+f*(g.wrappedWidth/u),S=c(g),p=I<S?S:I;e-=p-g.width,g.width=p}if(e=Math.round(1e10*e)/1e10){var y=A.filter(function(N){return!(e<0)||N.width>c(N)});y.length&&(e=C(y,e,c))}return e}function O(A,e,c,f,u){return A.map(function(n){return function(g,b,I,S,p){var y=1e4*S.scaleFactor();if((b=Math.ceil(b*y)/y)>=(0,T.getStringWidth)(g,I,S))return g;for(;b<(0,T.getStringWidth)(g+p,I,S)&&!(g.length<=1);)g=g.substring(0,g.length-1);return g.trim()+p}(n,e,c,f,u)})}_.calculateWidths=function(A,e){var n,g,b,I,S;g=e,b=(n=A).scaleFactor(),I=g.settings.horizontalPageBreak,S=x.default.getPageAvailableWidth(n,g),g.allRows().forEach(function(p){for(var y=0,N=g.columns;y<N.length;y++){var D=N[y],h=p.cells[D.index];if(h){g.callCellHooks(n,g.hooks.didParseCell,h,p,D,null);var q=h.padding("horizontal");h.contentWidth=(0,T.getStringWidth)(h.text,h.styles,n)+q;var J=(0,T.getStringWidth)(h.text.join(" ").split(/\s+/),h.styles,n);h.minReadableWidth=J+h.padding("horizontal"),"number"==typeof h.styles.cellWidth?(h.minWidth=h.styles.cellWidth,h.wrappedWidth=h.styles.cellWidth):"wrap"===h.styles.cellWidth||!0===I?h.contentWidth>S?(h.minWidth=S,h.wrappedWidth=S):(h.minWidth=h.contentWidth,h.wrappedWidth=h.contentWidth):(h.minWidth=h.styles.minCellWidth||10/b,h.wrappedWidth=h.contentWidth,h.minWidth>h.wrappedWidth&&(h.wrappedWidth=h.minWidth))}}}
1),g.allRows().forEach(function(p){for(var y=0,N=g.columns;y<N.length;y++){var D=N[y],h=p.cells[D.index];if(h&&1===h.colSpan)D.wrappedWidth=Math.max(D.wrappedWidth,h.wrappedWidth),D.minWidth=Math.max(D.minWidth,h.minWidth),D.minReadableWidth=Math.max(D.minReadableWidth,h.minReadableWidth);else{var M=g.styles.columnStyles[D.dataKey]||g.styles.columnStyles[D.index]||{},q=M.cellWidth||M.minCellWidth;q&&"number"==typeof q&&(D.minWidth=q,D.wrappedWidth=q)}h&&(h.colSpan>1&&!D.minWidth&&(D.minWidth=h.minWidth),h.colSpan>1&&!D.wrappedWidth&&(D.wrappedWidth=h.minWidth))}});var c=[],f=0;e.columns.forEach(function(n){var g=n.getMaxCustomCellWidth(e);g?n.width=g:(n.width=n.wrappedWidth,c.push(n)),f+=n.width});var u=e.getWidth(A.pageSize().width)-f;u&&(u=C(c,u,function(n){return Math.max(n.minReadableWidth,n.minWidth)})),u&&(u=C(c,u,function(n){return n.minWidth})),u=Math.abs(u),!e.settings.horizontalPageBreak&&u>.1/A.scaleFactor()&&(u=u<1?u:Math.round(u),console.error("Of the table content, "+u+" units width could not fit page")),function(n){for(var g=n.allRows(),b=0;b<g.length;b++)for(var I=g[b],S=null,p=0,y=0,N=0;N<n.columns.length;N++){var D=n.columns[N];if((y-=1)>1&&n.columns[N+1])p+=D.width,delete I.cells[D.index];else if(S){var h=S;delete I.cells[D.index],S=null,h.width=D.width+p}else{if(!(h=I.cells[D.index]))continue;if(y=h.colSpan,p=0,h.colSpan>1){S=h,p+=D.width;continue}h.width=D.width+p}}}(e),function(n,g){for(var b={count:0,height:0},I=0,S=n.allRows();I<S.length;I++){for(var p=S[I],y=0,N=n.columns;y<N.length;y++){var h=p.cells[N[y].index];if(h){g.applyStyles(h.styles,!0);var M=h.width-h.padding("horizontal");"linebreak"===h.styles.overflow?h.text=g.splitTextToSize(h.text,M+1/g.scaleFactor(),{fontSize:h.styles.fontSize}):"ellipsize"===h.styles.overflow?h.text=O(h.text,M,h.styles,g,"..."):"hidden"===h.styles.overflow?h.text=O(h.text,M,h.styles,g,""):"function"==typeof h.styles.overflow&&(h.text=h.styles.overflow(h.text,M)),h.contentHeight=h.getContentHeight(g.scaleFactor());var q=h.contentHeight/h.rowSpan;h.rowSpan>1&&b.count*b.height<q*h.rowSpan?b={height:q,count:h.rowSpan}:b&&b.count>0&&b.height>q&&(q=b.height),q>p.height&&(p.height=q)}}b.count--}}(e,A),function(n){for(var g={},b=1,I=n.allRows(),S=0;S<I.length;S++)for(var p=I[S],y=0,N=n.columns;y<N.length;y++){var D=N[y],h=g[D.index];if(b>1)b--,delete p.cells[D.index];else if(h)h.cell.height+=p.height,b=h.cell.colSpan,delete p.cells[D.index],h.left--,h.left<=1&&delete g[D.index];else{var M=p.cells[D.index];if(!M)continue;if(M.height=p.height,M.rowSpan>1){var q=I.length-S;g[D.index]={cell:M,left:M.rowSpan>q?q:M.rowSpan,row:p}}}}}(e)},_.resizeColumns=C,_.ellipsize=O},84:V=>{if(void 0===Q){var _=new Error("Cannot find module 'undefined'");throw _.code="MODULE_NOT_FOUND",_}V.exports=Q}},P={};function _e(V){var _=P[V];if(void 0!==_)return _.exports;var U=P[V]={exports:{}};return Ie[V].call(U.exports,U,U.exports,_e),U.exports}var ye={};return(()=>{var V=ye;Object.defineProperty(V,"__esModule",{value:!0}),V.Cell=V.Column=V.Row=V.Table=V.CellHookData=V.__drawTable=V.__createTable=V.applyPlugin=void 0;var _=_e(790),U=_e(587),T=_e(49),x=_e(858),C=_e(287);Object.defineProperty(V,"Table",{enumerable:!0,get:function(){return C.Table}});var O=_e(662);Object.defineProperty(V,"CellHookData",{enumerable:!0,get:function(){return O.CellHookData}});var A=_e(287);function e(f){(0,_.default)(f)}Object.defineProperty(V,"Cell",{enumerable:!0,get:function(){return A.Cell}}),Object.defineProperty(V,"Column",{enumerable:!0,get:function(){return A.Column}}),Object.defineProperty(V,"Row",{enumerable:!0,get:function(){return A.Row}}),V.applyPlugin=e,V.default=function(f,u){var n=(0,U.parseInput)(f,u),g=(0,x.createTable)(f,n);(0,T.drawTable)(f,g)},V.__createTable=function(f,u){var n=(0,U.parseInput)(f,u);return(0,x.createTable)(f,n)},V.__drawTable=function(f,u){(0,T.drawTable)(f,u)};try{var c=_e(84);c.jsPDF&&(c=c.jsPDF),e(c)}catch{}})(),ye})())}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.