(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:$("").html(null==e?void 0:e.company_name).text()})),this.commonService.companyList=null===(c=e.data)||void 0===c?void 0:c.map(e=>Object.assign(Object.assign({},e),{company_name:$("").html(null==e?void 0:e.company_name).text()})),setTimeout(()=>{let e=localStorage.getItem(a.a.LOCAL_STORAGE.SELECTED_COMPANY);e&&(e=this.interceptor.xyz(e),$("#select-company").val(e.id),$("#select-company").change())},0),this.spinner.hide()):(this.companyList=[],this.spinner.hide(),e.message&&this.commonService.showToaster("error",e.message))},e=>{this.spinner.hide(),this.commonService.showToaster("error","Something went wrong. Please try again.")}))}manageSelectCompany(){let e=this.companyList.filter(e=>e.id===$("#select-company").val());this.bankService.getCompanyBank({company_id:e.id}).subscribe(t=>{this.commonService.companyBankData=t.data,this.commonService.setSelectedCompany(e[0]),this.manageNavigation("/customer/dashboard")},t=>{this.commonService.setSelectedCompany(e[0]),this.manageNavigation("/customer/dashboard")})}manageNavigation(e){this.commonService.getCompany(),this.router.navigate([e])}loadJs(){var e=this;const t=$(window).outerHeight(!0),c=$(".pre-login-footer").outerHeight(!0);$(".pre-login").css("min-height",t-c+"px"),setTimeout(()=>{$("#select-jurisdiction").select2({minimumResultsForSearch:-1}),$("#select-jurisdiction").change(function(){let t=$(this).val();t?(localStorage.getItem(a.a.LOCAL_STORAGE.JURISDICTION_ID)!==t&&(localStorage.removeItem(a.a.LOCAL_STORAGE.SELECTED_COMPANY),e.commonService.selectedCompany={}),e.conciergeServiceDisabled=!1,e.setUpNewCompanyDisabled=!1,e.updateAccountDetailsDisabled=!1,localStorage.setItem(a.a.LOCAL_STORAGE.JURISDICTION_ID,t),e.getCompany()):e.setUpNewCompanyDisabled=!0})},10),setTimeout(()=>{$("#select-company").select2(),$("#select-company").change(function(){let t=$(this).val();e.goToDashboardButtonDisabled=!t,this.isJurisdiction&&(e.setUpNewCompanyDisabled=!t||!$("#select-jurisdiction").val())})},10),setTimeout(()=>{$("#select-user").select2(),$("#select-user").change(function(){let t=$(this).val();if(t){let c=e.userList.find(e=>e.id===t),i=localStorage.getItem(a.a.LOCAL_STORAGE.SELECTED_CUSTOMER);i&&(i=e.interceptor.xyz(i)),(null==i?void 0:i.id)!==t&&(localStorage.removeItem(a.a.LOCAL_STORAGE.SELECTED_COMPANY),e.commonService.selectedCompany={}),localStorage.setItem(a.a.LOCAL_STORAGE.SELECTED_CUSTOMER,e.interceptor.abc(c)),e.getCompany(),e.setUpNewCompanyDisabled=!(!e.isJurisdiction||t&&$("#select-jurisdiction").val()),e.conciergeServiceDisabled=!1,e.updateAccountDetailsDisabled=!1}else e.setUpNewCompanyDisabled=!0,e.conciergeServiceDisabled=!0,e.updateAccountDetailsDisabled=!0})},10)}logout(){this.commonService.logOut(!0)}getUserPreference(e){const t=this;t.userService.getUserPreference({user_id:e}).subscribe(e=>{if(200===e.status){delete e.data.user_id,delete e.data.id,t.commonService.selectedLanguage=e.data.language,t.commonService.selectedTheme=e.data.theme;let c=this.themeList.filter(e=>e.title===this.commonService.selectedTheme);c.length>0&&(c[0].css&&(this.commonService.selectedThemeCss=this.domSanitizer.bypassSecurityTrustResourceUrl(c[0].css)),this.commonService.selectedThemeImages=c[0].images,this.commonService.favIcon.href=this.commonService.selectedThemeImages+"/favicon.ico"),console.clear(),console.log("Get User Preference Response:",this.interceptor.abc(e.data)),localStorage.setItem(a.a.LOCAL_STORAGE.USER_PREFERENCES,this.interceptor.abc(e.data)),t.userService.getUserDetails({id:!0}).subscribe(e=>{let t=e.data[0],c="";""==t.twitter_url&&(c="Twitter"),""==t.insta_url&&(c=c?c+", Instagram":"Instagram"),""==t.linked_in_url&&(c=c?c+", LinkedIn":"LinkedIn"),""==t.facebook_url&&(c=c?c+", Facebook":"Facebook")})}else t.commonService.showToaster("error",e.message)},e=>{this.commonService.showToaster("error","Something went wrong. Please try again.")})}}return e.\u0275fac=function(t){return new(t||e)(u.Xb(p.c),u.Xb(n.d),u.Xb(h.g),u.Xb(h.d),u.Xb(h.b),u.Xb(h.m),u.Xb(b.c),u.Xb(h.l),u.Xb(S.a),u.Xb(p.b))},e.\u0275cmp=u.Rb({type:e,selectors:[["app-select-company"]],decls:41,vars:17,consts:[[1,"pre-login",3,"ngStyle"],[1,"container","pre-login-container"],[1,"row"],[1,"col-lg-5","col-md-6","col-sm-7"],[1,"shadow-card-wrapper","thumbnail"],[1,"card-header"],[1,"language-select","clearfix"],[1,"zone-logo","text-center"],["alt","Logo","title","Logo",3,"src"],["class","form-name text-center",4,"ngIf"],[1,"card-main"],[1,"login-form"],["class","form-group",4,"ngIf"],["class","example-form",4,"ngIf"],[1,"form-group"],[1,"material_input_block","select2-label"],[1,"title"],["id","select-company","tabindex","-1","aria-hidden","true",1,"select2",3,"disabled"],[3,"value",4,"ngFor","ngForOf"],[1,"btn","btn-primary","full-width","btn-block","text-uppercase",3,"disabled","click"],[1,"button-text"],[1,"btn","btn-block","btn-secondary",3,"disabled","click"],[4,"ngIf"],["class","btn btn-block btn-secondary",3,"disabled","click",4,"ngIf"],["class","btn btn-block btn-secondary",3,"click",4,"ngIf"],[1,"form-link"],["href","#","onclick","return false;",3,"click"],[1,"card-footer"],[1,"btn","btn-block","create-acc-link","text-center"],[1,"btn","btn-block","btn-secondary","update-details",3,"disabled","click"],["hasStickyFooter","true"],[1,"form-name","text-center"],["id","select-jurisdiction","tabindex","-1","aria-hidden","true",1,"select2"],[3,"value"],[1,"example-form"],[1,"example-full-width"],[1,"formGroup","ng-star-inserted"],[1,"select2-label"],["type","text","placeholder","Choose Customer","aria-label","choose-customer","matInput","",3,"formControl","matAutocomplete"],["autoActiveFirstOption","",3,"displayWith","optionSelected"],["auto","matAutocomplete"],[1,"btn","btn-block","btn-secondary",3,"click"]],template:function(e,t){1&e&&(u.dc(0,"section",0),u.dc(1,"div",1),u.dc(2,"div",2),u.dc(3,"div",3),u.dc(4,"div",4),u.dc(5,"header",5),u.Yb(6,"div",6),u.dc(7,"div",7),u.Yb(8,"img",8),u.cc(),u.Pc(9,_,2,1,"p",9),u.dc(10,"h1"),u.Rc(11," Choose company "),u.cc(),u.cc(),u.dc(12,"main",10),u.dc(13,"form",11),u.Pc(14,T,7,1,"div",12),u.Pc(15,E,9,6,"div",13),u.dc(16,"div",14),u.dc(17,"div",15),u.dc(18,"label",16),u.Rc(19,"Choose Company"),u.cc(),u.dc(20,"select",17),u.Yb(21,"option"),u.Pc(22,N,2,2,"option",18),u.cc(),u.cc(),u.cc(),u.dc(23,"button",19),u.kc("click",function(){return t.manageSelectCompany()}),u.dc(24,"span",20),u.Rc(25,"Go TO Dashboard!!"),u.cc(),u.cc(),u.dc(26,"button",21),u.kc("click",function(){return t.manageNavigation("customer/dashboard")}),u.dc(27,"span",20),u.Rc(28,"Setup new company"),u.cc(),u.cc(),u.Pc(29,A,4,2,"ng-container",22),u.Pc(30,D,3,1,"button",23),u.Pc(31,R,3,0,"button",24),u.dc(32,"div",25),u.dc(33,"a",26),u.kc("click",function(){return t.logout()}),u.Rc(34,"Log out "),u.cc(),u.cc(),u.cc(),u.cc(),u.dc(35,"footer",27),u.dc(36,"div",28),u.dc(37,"button",29),u.kc("click",function(){return t.manageNavigation("customer/profile")}),u.dc(38,"span",20),u.Rc(39,"Update Account Details"),u.cc(),u.cc(),u.cc(),u.cc(),u.cc(),u.cc(),u.cc(),u.cc(),u.cc(),u.Yb(40,"app-footer",30)),2&e&&(u.uc("ngStyle",u.zc(15,k,"url("+t.commonService.selectedThemeImages+"/bg-beam.svg), url("+t.commonService.selectedThemeImages+t.imageName+")")),u.Lb(8),u.uc("src",t.commonService.selectedThemeImages+"/zone-logo.svg",u.Jc),u.Lb(1),u.uc("ngIf",null==t.commonService||null==t.commonService.accessToken?null:t.commonService.accessToken.consultant_company_name),u.Lb(1),u.Nb(null!=t.commonService&&null!=t.commonService.accessToken&&t.commonService.accessToken.consultant_company_name?"form-name text-center choose-company":"form-name text-center"),u.Lb(4),u.uc("ngIf",t.isJurisdiction),u.Lb(1),u.uc("ngIf",t.commonService.user_type===t.environment.LOGIN_ROLE.AGENT||t.commonService.user_type===t.environment.LOGIN_ROLE.CONSULTANT1||t.commonService.user_type===t.environment.LOGIN_ROLE.CONSULTANT2||t.commonService.user_type===t.environment.LOGIN_ROLE.SUPER_ADMIN),u.Lb(5),u.uc("disabled",t.companyDisabled),u.Lb(2),u.uc("ngForOf",t.companyList),u.Lb(1),u.uc("disabled",t.goToDashboardButtonDisabled),u.Lb(3),u.uc("disabled",t.setUpNewCompanyDisabled),u.Lb(3),u.uc("ngIf",t.commonService.handleCheckVisibility(t.environment.MODULES.CONCIERGE_SERVICES)),u.Lb(1),u.uc("ngIf",t.commonService.user_type===t.environment.LOGIN_ROLE.AGENT),u.Lb(1),u.uc("ngIf",t.commonService.user_type===t.environment.LOGIN_ROLE.AGENT||t.commonService.user_type===t.environment.LOGIN_ROLE.CONSULTANT1||t.commonService.user_type===t.environment.LOGIN_ROLE.CONSULTANT2),u.Lb(6),u.uc("disabled",t.updateAccountDetailsDisabled))},directives:[i.o,i.n,o.A,o.o,o.p,o.r,o.B,i.m,g.a,v.b,L.a,o.b,C.c,o.n,o.d,y.a,C.a,O.e],pipes:[i.b],styles:[""]}),e})()}];let U=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=u.Vb({type:e}),e.\u0275inj=u.Ub({imports:[[n.f.forChild(w)],n.f]}),e})(),G=(()=>{class e{}return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=u.Vb({type:e}),e.\u0275inj=u.Ub({imports:[[o.h,o.w,i.c,s.a,U]]}),e})()}}]);