(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{"9U9y":function(e,t,c){"use strict";c.r(t),c.d(t,"SelectCompanyModule",function(){return G});var i=c("ofXK"),o=c("3Pt+"),s=c("PCNd"),n=c("tyNb"),a=c("AytR"),r=c("Kj3r"),l=c("/uUt"),m=c("lJxs"),d=c("IzEk"),u=c("fXoL"),p=c("jhN1"),h=c("o0su"),b=c("JqCM"),S=c("6LcO"),g=c("Iw+v"),v=c("kmnG"),L=c("qFsG"),C=c("/1cH"),y=c("t34c"),O=c("FKr1");function _(e,t){if(1&e&&(u.dc(0,"p",31),u.Rc(1),u.cc()),2&e){const e=u.oc();u.Lb(1),u.Sc(null==e.commonService||null==e.commonService.accessToken?null:e.commonService.accessToken.consultant_company_name)}}function f(e,t){if(1&e&&(u.dc(0,"option",33),u.Rc(1),u.cc()),2&e){const e=t.$implicit;u.uc("value",e.id),u.Lb(1),u.Sc(e.title)}}function T(e,t){if(1&e&&(u.dc(0,"div",14),u.dc(1,"div",15),u.dc(2,"label",16),u.Rc(3,"Choose Jurisdiction"),u.cc(),u.dc(4,"select",32),u.Yb(5,"option"),u.Pc(6,f,2,2,"option",18),u.cc(),u.cc(),u.cc()),2&e){const e=u.oc();u.Lb(6),u.uc("ngForOf",e.jurisdictionList)}}function I(e,t){if(1&e&&(u.dc(0,"mat-option",33),u.Rc(1),u.cc()),2&e){const e=t.$implicit;u.uc("value",e),u.Lb(1),u.Tc(" ",e.username," ")}}function E(e,t){if(1&e){const e=u.ec();u.dc(0,"div",34),u.dc(1,"mat-form-field",35),u.dc(2,"div",36),u.dc(3,"div",37),u.Yb(4,"input",38),u.dc(5,"mat-autocomplete",39,40),u.kc("optionSelected",function(t){return u.Gc(e),u.oc().customerSelected(t.option.value)}),u.Pc(7,I,2,2,"mat-option",18),u.pc(8,"async"),u.cc(),u.cc(),u.cc(),u.cc(),u.cc()}if(2&e){const e=u.Dc(6),t=u.oc();u.Lb(4),u.uc("formControl",t.userControl)("matAutocomplete",e),u.Lb(1),u.uc("displayWith",t.displayValue),u.Lb(2),u.uc("ngForOf",u.qc(8,4,t.filteredOptions))}}function N(e,t){if(1&e&&(u.dc(0,"option",33),u.Rc(1),u.cc()),2&e){const e=t.$implicit;u.uc("value",e.id),u.Lb(1),u.Sc(e.company_name)}}function A(e,t){if(1&e){const e=u.ec();u.bc(0),u.dc(1,"button",21),u.kc("click",function(){return u.Gc(e),u.oc().manageNavigation("customer/concierge-services")}),u.dc(2,"span",20),u.Rc(3),u.cc(),u.cc(),u.ac()}if(2&e){const e=u.oc();u.Lb(1),u.uc("disabled",e.conciergeServiceDisabled),u.Lb(2),u.Sc(e.conciergeServicesTitle)}}function D(e,t){if(1&e){const e=u.ec();u.dc(0,"button",21),u.kc("click",function(){return u.Gc(e),u.oc().manageNavigation("customer/my-request")}),u.dc(1,"span",20),u.Rc(2,"My Requests"),u.cc(),u.cc()}if(2&e){const e=u.oc();u.uc("disabled",e.setUpNewCompanyDisabled)}}function R(e,t){if(1&e){const e=u.ec();u.dc(0,"button",41),u.kc("click",function(){return u.Gc(e),u.oc().manageNavigation("add-customer")}),u.dc(1,"span",20),u.Rc(2,"Add Customer"),u.cc(),u.cc()}}const k=function(e){return{"background-image":e}},w=[{path:"",component:(()=>{class e{constructor(e,t,c,i,s,n,r,l,m,d){var u,p;this.titleService=e,this.router=t,this.interceptor=c,this.companyService=i,this.commonService=s,this.utilService=n,this.spinner=r,this.userService=l,this.bankService=m,this.domSanitizer=d,this.isJurisdiction=!1,this.isCustomer=!1,this.jurisdictionList=[],this.userList=[],this.companyList=[],this.environment=a.a,this.customerDisabled=!0,this.companyDisabled=!0,this.goToDashboardButtonDisabled=!0,this.setUpNewCompanyDisabled=!0,this.conciergeServiceDisabled=!0,this.updateAccountDetailsDisabled=!0,this.conciergeServicesTitle="Concierge Services",this.userControl=new o.c,this.options=[],this.subscriptions=[],this.themeList=[],this.imageName="/customer_choose_company.jpg",(null===(u=this.commonService)||void 0===u?void 0:u.zoneName)?this.titleService.setTitle("Choose Company | "+(null===(p=this.commonService)||void 0===p?void 0:p.zoneName)):this.titleService.setTitle("Choose Company")}ngOnInit(){this.conciergeServicesTitle=localStorage.getItem(a.a.CONCIERGE_SERVICE_NAME),this.commonService.user_type===a.a.LOGIN_ROLE.AGENT||this.commonService.user_type===a.a.LOGIN_ROLE.CONSULTANT1||this.commonService.user_type===a.a.LOGIN_ROLE.CONSULTANT2||this.commonService.user_type===a.a.LOGIN_ROLE.SUPER_ADMIN?(this.isCustomer=!1,this.imageName=this.commonService.user_type===a.a.LOGIN_ROLE.AGENT?"/customer_choose_company.jpg":"/cp_choose_company.jpg",this.imageName="/cp_choose_company.jpg"):(this.imageName="/customer_choose_company.jpg",this.isCustomer=!0,this.setUpNewCompanyDisabled=!1,this.conciergeServiceDisabled=!1,this.updateAccountDetailsDisabled=!1),localStorage.getItem(a.a.LOCAL_STORAGE.IS_JURISDICTION)&&1===parseInt(localStorage.getItem(a.a.LOCAL_STORAGE.IS_JURISDICTION))?(this.isJurisdiction=!0,this.conciergeServiceDisabled=!0,this.setUpNewCompanyDisabled=!0,this.updateAccountDetailsDisabled=!0,this.getJurisdiction()):(this.isJurisdiction=!1,this.isCustomer&&this.getCompany()),this.filteredOptions=this.userControl.valueChanges.pipe(Object(r.a)(500),Object(l.a)(),Object(m.a)(e=>{const t=e&&(null==e?void 0:e.toString().toLowerCase()),c=[];if(t.length<5)return c;if(this.spinner.show(),t&&""!=t){let e={role_id:a.a.LOGIN_ROLE.CUSTOMER,for_dropdown:1,status:a.a.STATUS.ACTIVE};e.searchText=t,this.commonService.user_type!==a.a.LOGIN_ROLE.CONSULTANT1&&this.commonService.user_type!==a.a.LOGIN_ROLE.CONSULTANT2||(e.parent_id=!0),this.userControl.disable(),this.userService.getFilteredUsersArray(e).pipe(Object(d.a)(1)).subscribe({next:e=>{var t;console.log("\ud83d\ude80 ~ file: select-company.component.ts:126 ~ SelectCompanyComponent ~ this.userService.getFilteredUsersArray ~ response:",e),null===(t=null==Object?void 0:Object.values(e.data))||void 0===t||t.forEach(e=>{c.push(e)}),this.spinner.hide()},error:()=>{this.spinner.hide(),this.commonService.showToaster("error","Something went wrong. Please try again.")},complete:()=>{this.spinner.hide(),this.userControl.enable()}})}else this.companyList=[],this.goToDashboardButtonDisabled=!0,this.setUpNewCompanyDisabled=!0,this.conciergeServiceDisabled=!0,this.updateAccountDetailsDisabled=!0,this.spinner.hide(),this.onCustomerBlankValueSelected();return console.log("\ud83d\ude80 ~ file: select-company.component.ts:107 ~ SelectCompanyComponent ~ map ~ options:",c),c}))}displayValue(e){return e?null==e?void 0:e.username:""}customerSelected(e){let t=e;if(t){let e=localStorage.getItem(a.a.LOCAL_STORAGE.SELECTED_CUSTOMER);e&&(e=this.interceptor.xyz(e)),(null==e?void 0:e.id)!==t.id&&(localStorage.removeItem(a.a.LOCAL_STORAGE.SELECTED_COMPANY),this.commonService.selectedCompany={}),localStorage.setItem(a.a.LOCAL_STORAGE.SELECTED_CUSTOMER,this.interceptor.abc(t)),this.getCompany(),this.commonService.isVisaCounterEnabled&&this.getUserPreference(t.id),this.setUpNewCompanyDisabled=!(!this.isJurisdiction||t&&$("#select-jurisdiction").val()),this.conciergeServiceDisabled=!1,this.updateAccountDetailsDisabled=!1}}onCustomerBlankValueSelected(){this.subscriptions.forEach(e=>{e.unsubscribe()})}ngAfterViewInit(){this.loadJs()}getCustomers(){let e={role_id:a.a.LOGIN_ROLE.CUSTOMER,for_dropdown:1,status:a.a.STATUS.ACTIVE};this.commonService.user_type!==a.a.LOGIN_ROLE.CONSULTANT1&&this.commonService.user_type!==a.a.LOGIN_ROLE.CONSULTANT2||(e.parent_id=!0),this.customerDisabled=!0,this.spinner.show(),this.userService.getUsersAtLogin(e).subscribe(e=>{this.customerDisabled=!1,200===e.status?(this.userList=e.data.result,setTimeout(()=>{let e=localStorage.getItem(a.a.LOCAL_STORAGE.SELECTED_CUSTOMER);e&&(e=this.interceptor.xyz(e),$("#select-user").val(e.id),$("#select-user").change())},0),this.spinner.hide()):(this.userList=[],this.spinner.hide())})}getJurisdiction(){this.spinner.show(),this.utilService.getJurisdiction().subscribe(e=>{this.jurisdictionList=200===e.status?e.data:[],setTimeout(()=>{let e=localStorage.getItem(a.a.LOCAL_STORAGE.JURISDICTION_ID);e&&($("#select-jurisdiction").val(e),$("#select-jurisdiction").change())},0),this.spinner.hide()},e=>{this.spinner.hide(),this.commonService.showToaster("error","Something went wrong. Please try again.")})}getCompany(){let e=this.interceptor.xyz(localStorage.getItem(a.a.LOCAL_STORAGE.ACCESS_TOKEN));var t={jurisdiction_id:"1"===localStorage.getItem(a.a.LOCAL_STORAGE.IS_JURISDICTION)?localStorage.getItem(a.a.LOCAL_STORAGE.JURISDICTION_ID):1,user_id:!this.isCustomer||parseInt(e.id),email:!0};this.companyDisabled=!0,this.spinner.show(),this.subscriptions.push(this.companyService.getCompany(t).subscribe(e=>{var t,c;this.companyDisabled=!1,200===e.status?(this.companyList=null===(t=e.data)||void 0===t?void 0:t.map(e=>Object.assign(Object.assign({},e),{company_name:$("